Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Drop Down Coding problem with button image
Old 10-13-2009, 04:44 PM Drop Down Coding problem with button image
Junior Talker

Posts: 3
Trades: 0
Hi I was wondering if you could help me with my website?


I have the following code that needs to be implemented onto our homepage

HTML Code:
  <SCRIPT TYPE="text/javascript">
  <!--
  function dropdown(mySel)
  {
  var myWin, myVal;
  myVal = mySel.options[mySel.selectedIndex].value;
  if(myVal)
     {
     if(mySel.form.target)myWin = parent[mySel.form.target];
     else myWin = window;
     if (! myWin) return true;
     myWin.location = myVal;
     }
  return false;
  }
  //-->
  </SCRIPT>
  <table width="511" border="0" align="center">
    <tr>
      <td width="505" height="153" align="center"><FORM 
       ACTION="../cgi-bin/redirect.pl" 
       METHOD=POST onSubmit="return dropdown(this.gourl)">
        <p><br>
              <br>
              <br>
              <br>
        </p>
        <p>
          <select name="example" onChange="redirect(this.options.selectedIndex)">
            <option>Select Size</option>
            <option>Model A ($49.99)</option>
            <option>Model B ($69.00)</option>
            <option>Model C ($76.80)</option>
            <option>Model D ($83.60)</option>
            <option>Model E ($89.80)</option>
            <option>Model F ($95.60)</option>
          </select>
          <select name="stage2">
            <option value="#">Select a Color</option>
            <option value="#">Grey</option>
            <option value="#">Blue</option>
          </select>
          <br>
          <br>
          <input name="submit2" type="image" id="submit2" src="http://www.boatcoverscover.com/images/stories/buynow.gif" alt="Submit Form" width="174" height="35" border="0">
        </p>
      </FORM></td>
    </tr>
    <tr>
      <td height="25" align="left" valign="bottom"><div align="left"><a href="#SC"><img src="http://www.boatcoverscover.com/images/stories/semi-custom.gif" alt="" width="132" height="23" border="0"></a></div></td>
    </tr>
  </table>
  
   <script>
  <!--
  
  /*
  Double Combo Script Credit
  By JavaScript Kit ([URL="http://www.javascriptkit.com"]www.javascriptkit.com[/URL])
  Over 200+ free JavaScripts here!
  */
  
  var groups=document.doublecombo.example.options.length
  var group=new Array(groups)
  for (i=0; i<groups; i++)
  group[i]=new Array()
  
  group[0][0]=new Option("Select a Color","#")
  
  group[1][0]=new Option("Select a Color","#")
  group[1][1]=new Option("Grey","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=645")
  group[1][2]=new Option("Blue","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=1892")
  
  
  
  group[2][0]=new Option("Select a Color","#")
  group[2][1]=new Option("Grey","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=646")
  group[2][2]=new Option("Blue","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=1893")
  
  
  
  group[3][0]=new Option("Select a Color","#")
  group[3][1]=new Option("Grey","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=647")
  group[3][2]=new Option("Blue","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=1894")
  
  
  
  group[4][0]=new Option("Select a Color","#")
  group[4][1]=new Option("Grey","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=648")
  group[4][2]=new Option("Blue","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=1895")
  
  
  
  group[5][0]=new Option("Select a Color","#")
  group[5][1]=new Option("Grey","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=649")
  group[5][2]=new Option("Blue","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=1896")
  
  
  
  group[6][0]=new Option("Select a Color","#")
  group[6][1]=new Option("Grey","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=650")
  group[6][2]=new Option("Blue","http://boatcoverscover.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage-ask.tpl&product_id=1897")
  
  
  
  
  
  var temp=document.doublecombo.stage2
  
  function redirect(x){
  for (m=temp.options.length-1;m>0;m--)
  temp.options[m]=null
  for (i=0;i<group[x].length;i++){
  temp.options[i]=new Option(group[x][i].text,group[x][i].value)
  }
  temp.options[0].selected=true
  }
  
  function go(){
  location=temp.options[temp.selectedIndex].value
  }
  //-->
  </script>
  
  However it doesn’t seem to work L 
   But the code that I am currently using, the only difference being that it is a single drop down instead of a double dropdown, works perfectly fine.
   
  <SCRIPT TYPE="text/javascript">
  <!--
  function dropdown(mySel)
  {
  var myWin, myVal;
  myVal = mySel.options[mySel.selectedIndex].value;
  if(myVal)
     {
     if(mySel.form.target)myWin = parent[mySel.form.target];
     else myWin = window;
     if (! myWin) return true;
     myWin.location = myVal;
     }
  return false;
  }
  //-->
  </SCRIPT>
  <table width="511" border="0" align="center">
    <tr>
      <td width="505" height="153" align="center"><FORM 
       ACTION="../cgi-bin/redirect.pl" 
       METHOD=POST onSubmit="return dropdown(this.gourl)">
        <p><br>
              <br>
              <br>
              <br>
        </p>
        <p>
          <select name="gourl" id="gourl">
            <option value="#">Select Model From List</option>
            <option value="http://boatcoverscover.com/component/virtuemart/?page=shop.product_details&amp;flypage=flypage.tpl&amp;product_id=645&amp;vmcchk=1">Model A ($49.99)</option>
            <option value="http://boatcoverscover.com/index.php?option=com_virtuemart&amp;page=shop.product_details&amp;flypage=flypage.tpl&amp;product_id=646">Model B (add $19.01)</option>
            <option value="http://boatcoverscover.com/index.php?option=com_virtuemart&amp;page=shop.product_details&amp;flypage=flypage.tpl&amp;product_id=647">Model C (add $26.81)</option>
            <option value="http://boatcoverscover.com/index.php?option=com_virtuemart&amp;page=shop.product_details&amp;flypage=flypage.tpl&amp;product_id=648">Model D (add $33.61)</option>
            <option value="http://boatcoverscover.com/index.php?option=com_virtuemart&amp;page=shop.product_details&amp;flypage=flypage.tpl&amp;product_id=649">Model E (add $39.81)</option>
            <option value="http://boatcoverscover.com/index.php?option=com_virtuemart&amp;page=shop.product_details&amp;flypage=flypage.tpl&amp;product_id=650">Model F (add $45.61)</option>
          </select>
          <br>
          <br>
          <input name="submit2" type="image" id="submit2" src="http://www.boatcoverscover.com/images/stories/buynow.gif" alt="Submit Form" width="174" height="35" border="0">
        </p>
      </FORM></td>
    </tr>
    <tr>
      <td height="25" align="left" valign="bottom"><div align="left"><a href="#SC"><img src="http://www.boatcoverscover.com/images/stories/semi-custom.gif" alt="" width="132" height="23" border="0"></a></div></td>
    </tr>
  </table>
I have tried everything I know but still come up with either address not found or it just doesn’t even do anything.

Any help would be much appreciated!


Thanks,
Ryan Loeffler
support@eevelle.com

Last edited by chrishirst; 10-14-2009 at 06:15 PM.. Reason: code delimiters added
rtloeffler is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-14-2009, 06:19 PM Re: Drop Down Coding problem with button image
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Please use code delimiters when posting code.

That way if we need to copy and paste we can without having to remove a lot of formatting code as well.
Thank You
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-15-2009, 01:32 PM Re: Drop Down Coding problem with button image
Junior Talker

Posts: 3
Trades: 0
sorry about that. wont happen again. anyway do you know what is going on with that code?
rtloeffler is offline
Reply With Quote
View Public Profile
 
Old 10-15-2009, 02:08 PM Re: Drop Down Coding problem with button image
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
No idea. Perhaps if you explained what the problems are we would have a clue.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-15-2009, 05:12 PM Re: Drop Down Coding problem with button image
Junior Talker

Posts: 3
Trades: 0
Quote:
Originally Posted by chrishirst View Post
No idea. Perhaps if you explained what the problems are we would have a clue.
Its the double drop down menu that is not working. just goes to /cgi-bin and has an error its suppose to go through there but not stop there you know what i mean?
rtloeffler is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Drop Down Coding problem with button image
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.80713 seconds with 12 queries