Solved

Javascript Dropdown Menu Reset Issue

Posted on 2007-11-30
3
1,756 Views
Last Modified: 2008-02-21
I inherited this site development from a couple of yokels.  It mostly runs on Shopsite, with which I have enormous issue, but this is a (probably) simple javascript issue.  I come from an ASP/VB background and haven't really ever used Javascript.  I know I'll need to learn it, and I have gone over this code to try to understand it.  So far, I cannot solve this problem.

When one goes to our site (www.midweststereo.com) they will find a dropdown menu in the upper right hand corner.  It takes customers to specific manufacturer's pages.  It works as long as another link is clicked between uses of the dropdown menu.  However, if someone selects, for example, JBL, goes to that page, and then goes back into the menu because they meant to click Hosa, it will not execute.  I have included the script function code that's in the head section of the page, and the code for the dropdown menu.

HEAD SECTION
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>

BODY SECTION

   <td align="center" valign="top"><form name="form1" id="form1">
          <label>
          <select name="select" onchange="MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0)">
            <option>::Shop By Brand::</option>
            <option value="ableton_store.html">Ableton</option>
            <option value="akai_store.html">Akai</option>
            <option value="akg_store.html">AKG</option>
            <option value="alesis_store.html">Alesis</option>
            <option value="allen_heath_store.html">Allen &amp; Heath</option>
            <option value="alto_store.html">Alto</option>
            <option value="ameraudio_store.html">American Audio</option>
            <option value="amerdj_store.html">American DJ</option>
            <option value="antari_store.html">Antari</option>
            <option value="art_store.html">ART</option>
            <option value="audio_technica_store.html">Audio Technica</option>
            <option value="auralex_store.html">Auralex</option>
            <option value="bbe_store.html">BBE</option>
            <option value="behringer_store.html">Behringer</option>
            <option value="boss_store.html">Boss</option>
            <option value="cad_store.html">CAD</option>
            <option value="cakewalk_store.html">Cakewalk</option>
            <option value="cerwin_vega_store.html">Cerwin Vega</option>
            <option value="chauvet_store.html">Chauvet</option>
            <option value="cortex_store.html">Cortex</option>
            <option value="crest_audio_store.html">Crest Audio</option>
            <option value="crown_store.html">Crown</option>
            <option value="dbx_store.html">DBX</option>
            <option value="denon_store.html">Denon</option>
            <option value="digidesign_store.html">Digidesign</option>
            <option value="dynacord_store.html">Dynacord</option>
            <option value="eaw_store.html">EAW</option>
            <option value="echo_audio_store.html">Echo Audio</option>
            <option value="ecler_store.html">Ecler</option>
            <option value="edirol_store.html">Edirol</option>
            <option value="elation_store.html">Elation</option>
            <option value="electrovoice_store.html">Electro Voice</option>
            <option value="gator_store.html">Gator</option>
            <option value="gemini_store.html">Gemini</option>
            <option value="global_truss_store.html">Global Truss</option>
            <option value="grado_store.html">Grado</option>
            <option value="grundorf_store.html">Grundorf</option>
            <option value="hosa_store.html">Hosa</option>
            <option value="jbl_store.html">JBL</option>
            <option value="klarkteknik_store.html">Klark Teknik</option>
            <option value="korg_store.html">Korg</option>
            <option value="lexicon_store.html">Lexicon</option>
            <option value="lillite_store.html">LittleLite</option>
            <option value="mach_store.html">Mach</option>
            <option value="mackie_store.html">Mackie</option>
            <option value="ma_lighting_store.html">MA Lighting</option>
            <option value="martin_store.html">Martin</option>
            <option value="maudio_store.html">M-Audio</option>
            <option value="max_optical_store.html">Max Optical</option>
            <option value="novation_store.html">Novation</option>
            <option value="numark_store.html">Numark</option>
            <option value="odyssey_store.html">Odyssey</option>
            <option value="omnisistems_store.html">Omnisistems</option>
            <option value="ortofon_store.html">Ortofon</option>
            <option value="pcdj_store.html">PCDJ</option>
            <option value="peavey_store.html">Peavey</option>
            <option value="pioneer_store.html">Pioneer</option>
            <option value="presonus_store.html">Presonus</option>
            <option value="qsc_store.html">QSC</option>
            <option value="quiklok_store.html">Quicklok</option>
            <option value="rane_store.html">Rane</option>
            <option value="raxxess_store.html">Raxxess</option>
            <option value="roadready_store.html">Road Ready</option>
            <option value="rode_store.html">Rode</option>
            <option value="roland_store.html">Roland</option>
            <option value="samson_store.html">Samson</option>
            <option value="sefour_store.html">Sefour</option>
            <option value="sennheiser_store.html">Sennheiser</option>
            <option value="shure_store.html">Shure</option>
            <option value="sicmats_store.html">SicMats</option>
            <option value="sony_store.html">Sony</option>
            <option value="soundcraft_store.html">Soundcraft</option>
            <option value="spacetek_store.html">Spaceteck</option>
            <option value="stanton_store.html">Stanton</option>
            <option value="tannoy_store.html">Tannoy</option>
            <option value="tapco_store.html">Tapco</option>
            <option value="tascam_store.html">Tascam</option>
            <option value="tc_elec_store.html">TC Electronics</option>
            <option value="tchelicon_store.html">TC Helicon</option>
            <option value="technics_store.html">Technics</option>
            <option value="udg_store.html">UDG</option>
            <option value="ultimate_store.html">Ultimate</option>
            <option value="urei_store.html">Urei</option>
            <option value="vestax_store.html">Vestax</option>
            <option value="yorkville_store.html">Yorkville</option>
            <option value="zoom_store.html">Zoom</option>
                </select>
          </label>
          <br />
              <br />
            </form>            </td>
0
Comment
Question by:mychiefs58
3 Comments
 
LVL 12

Accepted Solution

by:
Sinoj Sebastian earned 50 total points
ID: 20384996
following code is missing in all other pages (manufacturer's pages) please add it and test it.

also you do not need to call the same function twice
onchange="MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0)"
use
onchange="MM_jumpMenu('parent',this,0);"
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>

Open in new window

0
 
LVL 1

Expert Comment

by:Computer101
ID: 20953171
Forced accept.

Computer101
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question