zl程序教程

您现在的位置是:首页 >  后端

当前栏目

【转】js onclick用法:跳转到指定URL

JS 用法 指定 url 跳转 onClick
2023-09-11 14:19:52 时间

使用onclick跳转到其他页面/跳转到指定url

 
☆如果是本页显示可以直接用location,方法如下:
①onclick="javascript:window.location.href='URL'"
②onclick="location='URL'"
③onclick="window.location.href='URL?id=11'"
☆如果页面中有frame可以将在location前面添加top.mainframe.frames['right_frame'].location
 
例:
<pre>
======
 
<input  type="button"value="注册"  onclick="javascript:window.location.href='register.php'"/>
 
======
</pre>
 
 
转自:http://blog.sina.com.cn/s/blog_755f73940101h84x.html