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

加入这段javascript。在页头。

  1. <SCRIPT language=javascript>
  2. function mbar(sobj) {
  3. var docurl =sobj.options[sobj.selectedIndex].value;
  4. if (docurl != "") {
  5. open(docurl,'_self');
  6. sobj.selectedIndex=0;
  7. sobj.blur();
  8. }
  9. }
  10. </SCRIPT>

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

  1. </select><!--YuanzifanUpdate End-->
  2. <!--YuanzifanUpdate Start-->
  3. <select onchange=mbar(this) name="select">
  4. <?PHP for($xPageCode=1;$xPageCode<=$total_Page_nums;$xPageCode++)
  5. echo "<option value=\"$RedirectURL$xPageCode\">".$xPageCode."</a></option>"
  6. ?>
  7. </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
原梓番博客
 

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证
加载中...