开发者

how to include a link in an <option> tag with JavaScript

开发者 https://www.devze.com 2023-04-03 22:52 出处:网络
I\'m having trouble making my list box links work.I found the following code on this w开发者_Go百科ebsite, but when I preview it in the browser, the link works for the fist option I choose, but if I t

I'm having trouble making my list box links work. I found the following code on this w开发者_Go百科ebsite, but when I preview it in the browser, the link works for the fist option I choose, but if I try a second option, the browser tells me it can't find the page.

<select onchange="javascript:handleSelect(this)">

<option value="../Pages/Examples of Business plans/Business plan samples">Agriculture</option>
<option value="../Pages/Examples of Business plans/Business plan samples">Automotive</option>
<option value="../Pages/Examples of Business plans/Business plan samples">Hospitality</option>

</select>

                     <script type="text/javascript">
                     function handleSelect(elm)
                     {
                     window.location = elm.value+".php";
                     }
                     </script>


The file does not exist in that directory.

i.e. There is no file named 'value of the elm control' with '.php' appended to it in the directory of the code you are using there.

0

精彩评论

暂无评论...
验证码 换一张
取 消