
<select><option selected="selected">Change to URL X</option><option>Change to URL Y</option></select>
应该使用什么JavaScript?
解决方法<script type="text/JavaScript">function navigateto(sel,target,newWindow) { var url = sel.options[sel.selectedindex].value; if (newWindow) { window.open(url,'--- attributes here,see below ---'); } else { window[target].location.href = url; }}</script><select onchange="navigateto(this,'window',false);"><option selected="selected" value="http://www.example.com/#X">Change to URL X</option><option value="http://www.example.com/#Y">Change to URL Y</option></select> 目标的一些有用值可能是“窗口”(当前窗口)或“顶部”(打破框架集或iframe).如果你想打开一个新窗口,可以使用navigateto(this,’someWindow’,true);
‘— attributes —‘的值使用here for Mozilla和here for IE记录的各种属性设置.例如:
'height=300,wIDth=400,top=100,left=100,statusbar=0,toolbar=1'总结
以上是内存溢出为你收集整理的通过html选择更改URL全部内容,希望文章能够帮你解决通过html选择更改URL所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)