Rij*_*hna 3 javascript onclick button location-href
我有一个网页 - http://www.example.com/ - 我有一个按钮.点击按钮,我需要转到特定链接(www.google.com).按钮如下:
<input type="button"
onclick="javascript:location.href='www.google.com'"
value="Click" />
Run Code Online (Sandbox Code Playgroud)
但是,此按钮会打开一个页面"http://www.example.com/www.google.com",这是一个错误的网址.
我已经试过window.location,document.location,document.location.href,location.href但一切都是徒劳.
我的onclick中的URL不能限制为以'http://'开头.
| 归档时间: |
|
| 查看次数: |
5379 次 |
| 最近记录: |