bootstrap按钮onclick和location.href

Mac*_*ess 3 javascript button twitter-bootstrap

有什么理由不行吗?

<button class="btn btn-primary btn-lg" onClick="location.href='http://anothersitehere.com/file.pdf'">Download PDF</button>
Run Code Online (Sandbox Code Playgroud)

Md.*_*din 8

你会尝试使用它

<a class="btn btn-primary btn-lg" href="http://anothersitehere.com/file.pdf">
   Download PDF
</a>
Run Code Online (Sandbox Code Playgroud)