通过combox选择转到另一个html文件 [英] Going to another html file via combox selection

查看:121
本文介绍了通过combox选择转到另一个html文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



假设我的项目中有两个html文件。我们称之为1.html和2.html。



我也有一个这样的组合框..

 <  选择 >  

< 选项 value = html1 > 得到html 1 < / option >
< option value = html2 > 转到html 2 < / option >
< / select >





我想选择选项1打开1.html文件或选择opition 2去2.html 。



i已经尝试过这个..比如下面但它不起作用

 <  选择 >  

< 选项 = html1 href = #/ folder1 / 1 > >得到html 1 < / option >

< 选项 value = html2 href = #/ folder1 / 2 > 转到html 2 < / option >
< / select >

解决方案

请参阅此示例以获取下拉菜单





 <  选择    onchange   =  window.open(this.options [this.selectedIndex] .value,'_ top') >  
< 选项 value = > 选择目的地... < / option >
< 选项 value = / 1.html > YAHOO < / option >
< 选项 = / 2.html > GOOGLE < / option > ;
< / select >





MY JS小提琴示例这里



http://jsfiddle.net/y4yAP/466/ [ ^


Hello All,

lets say i have two html files in my project. lets call them 1.html and 2.html.

I have also got a combobox like so ..

<select>

         <option value="html1"> got to html 1 </option>
         <option value="html2"> go to html 2 </option>
</select>



I would like when either option 1 is selected to open up the 1.html file or when opition 2 is selected to go 2.html.

i have tried to this .. like below but its not working

<select>

         <option value="html1"  href="#/folder1/1"> > got to html 1 </option>

         <option value="html2"  href="#/folder1/2"> go to html 2 </option>
</select>

解决方案

See this example for dropdown


<select onchange="window.open(this.options[this.selectedIndex].value,'_top')">
    <option value="">Choose a destination...</option>
    <option value="/1.html">YAHOO</option>
    <option value="/2.html">GOOGLE</option>
</select>



MY JS Fiddle example here

http://jsfiddle.net/y4yAP/466/[^]


这篇关于通过combox选择转到另一个html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆