Creating drop menu navigation with <select>

2019-04-28 17:21发布

I've managed to make myself drop menu navigation with html <select>. I've encountered one problem, though.

My external links aren't working. Namely Youtube.

Here is the code:

   <select ONCHANGE="location = this.options[this.selectedIndex].value;">

   <option value="" selected="selected">Navigation</option>

   <option value="index.html">Home</option>
   <option value="detroitvideoproduction.html">Video Production</option>
   <option value="locationsounddetroit.html">Location Sound</option>
   <option value="videoeditingdetroit.html">Video Editing</option>
   <option value="custommotiongraphicsdetroit.html">Custom Graphics</option>
   <option value="demoreel.html">Demo Reel</option>
   <option value="http://www.youtube.com/user/VideoDetroitMI?ob=0">You Tube</option>
   <option value="http://vimeo.com/liveoutloudproductions">Vimeo</option>
   <option value="dslrrentalsdetroit.html">Camera Rental</option>
    <option value="lectrosonicsrentalsdetroit.html">Audio Rental</option>
    <option value="griprentalsdetroit.html">Grip Rental</option>
    <option value="camerasupportdetroit.html">Camera Support</option>
    <option value="about.html">About Us</option>
    <option value="contact.html">Contact</option>
                 </select>

As you can see I have 2 external links. One to Vimeo, the other to Youtube. When you select Vimeo it works perfectly fine and takes you to the appropriate vimeo page, but when you select Youtube, it does nothing at all.

I know the URL in the link is correct, I checked it before I posted this.

Anybody know why Youtube wont work when Vimeo will?

3条回答
劫难
2楼-- · 2019-04-28 17:39

Well you're not going to want to hear this, but it worked fine for me... i copied and pasted the code and tested it with Chrome and it went to your page just fine.

查看更多
倾城 Initia
3楼-- · 2019-04-28 17:45

You might want to change you onChange with this: window.location.href=this.value

查看更多
爷的心禁止访问
4楼-- · 2019-04-28 17:48

Some browsers may be objecting to seeing a ? in the string in a select list. Try converting your YouTube URL using TinyURL. I haven't tested, but I'm guessing that will do the trick.

查看更多
登录 后发表回答