使用JavaScript使得Select标签无需按钮直接跳转的方法

原梓番
原梓番
管理员
827
文章
0
粉丝
常用教程评论2,143阅读模式

加入这段javascript。在页头。

<SCRIPT language=javascript>
		function mbar(sobj) {
		                                 var docurl =sobj.options[sobj.selectedIndex].value;
		                                 if (docurl != "") {
						        open(docurl,'_self');
						        sobj.selectedIndex=0;
						         sobj.blur();
						         }
						}
</SCRIPT>

用PHP输入指定的字符文章源自原紫番博客-https://www.yuanzifan.com/54469.html

</select>页<!--YuanzifanUpdate End-->					
			
          <!--YuanzifanUpdate Start-->
			<select onchange=mbar(this) name="select">
	<?PHP	for($xPageCode=1;$xPageCode<=$total_Page_nums;$xPageCode++)
		        echo "<option value=\"$RedirectURL$xPageCode\">".$xPageCode."</a></option>"			
	?>				
			</select>页<!--YuanzifanUpdate End-->

用For循环写入Select 的Value,然后Value设置成超链接。文章源自原紫番博客-https://www.yuanzifan.com/54469.html

这个Select 的标签要加上onChange事件,这个事件就是跳转。文章源自原紫番博客-https://www.yuanzifan.com/54469.html

文章源自原紫番博客-https://www.yuanzifan.com/54469.html 文章源自原紫番博客-https://www.yuanzifan.com/54469.html

站长微信
扫码添加(注明来意)
weinxin
Yuanzifan99
微信号已复制
原梓番博客公众号
博客内容精选
weinxin
原梓番博客
公众号已复制
 

发表评论

匿名网友
确定

拖动滑块以完成验证