Help with snippet

Discussion in 'JavaScript' started by adamjthompson, Feb 18, 2006.

  1. #1
    Hey, I've used this code multiple times, but it's not working this time. I assume that it has to do with the fact that I'm using it three times on the same page...any help?

     <script language="JavaScript">
    // This script was found at www.skilton.net
    // and was written by Alex C. Skilton of acs.net
    // Please keep this notice as a courtesy
    function jumplink(acs) {
    loc=document.acsform.acslist.options
    [document.acsform.acslist.selectedIndex].value;
    location.href = loc
    }
    </script>
    <form name="acsform">
    <select name="acslist"><option value="">Please Select:</option><option value="http://ww4.aitsafe.com/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+Capsules+One+Time+Order&amp;price=42.16&amp;units=1">One Time Order: $42.16</option><option value="http://ww4.aitsafe.com/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+Capsules+Monthly+Order&amp;price=37.94&amp;units=1">Monthly Order: $37.94</option></select>
    <input value="Add to Cart" onclick="jumplink(this.form)" type="button"> </form>
    
    </font></small></b><div align="center"><small><font face="Helvetica, Arial, sans-serif"><br>
    </font></small>
    <hr color="#000066" noshade="noshade" size="1" width="100%"><small><b><font face="Helvetica, Arial, sans-serif"><big>Bulk Powder<br>
    <br>
    </big></font><font color="#000066" face="Helvetica, Arial, sans-serif" size="-1">75 Gram Tub:</font></b></small><b><font face="Helvetica, Arial, sans-serif" size="-1"><br>
    <script language="JavaScript">
    // This script was found at www.skilton.net
    // and was written by Alex C. Skilton of acs.net
    // Please keep this notice as a courtesy
    function jumplink(acs) {
    loc=document.acsform2.acslist2.options
    [document.acsform2.acslist2.selectedIndex].value;
    location.href = loc
    }
    </script>
    <form name="acsform2">
    <select name="acslist2"><option value="">Please Select:</option><option value="http://ww4.aitsafe.com/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+75+Gram+Powder+One+Time+Order&amp;price=72.75&amp;units=1">One Time Order: $72.75</option><option value="http://ww4.aitsafe.com/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+75+Gram+Powder+Monthly+Order&amp;price=65.48&amp;units=1">Monthly Order: $65.48</option></select>
    <input value="Add to Cart" onclick="jumplink(this.form)" type="button"> </form>
    </font></b><small><font face="Helvetica, Arial, sans-serif">
    <br>
    <b><font color="#000066">150 Gram Tub:</font><br>
    <script language="JavaScript">
    // This script was found at www.skilton.net
    // and was written by Alex C. Skilton of acs.net
    // Please keep this notice as a courtesy
    function jumplink(acs) {
    loc=document.acsform3.acslist3.options
    [document.acsform3.acslist3.selectedIndex].value;
    location.href = loc
    }
    </script>
    <form name="acsform3">
    <select name="acslist3"><option value="">Please Select:</option><option value="http://ww4.aitsafe.com/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+150+Gram+Powder+One+Time+Order&amp;price=132.25&amp;units=1">One Time Order: $132.25</option><option value="http://ww4.aitsafe.com/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+150+Gram+Powder+Monthly+Order&amp;price=119.03&amp;units=1">Monthly Order: $119.03</option></select>
    <input value="Add to Cart" onclick="jumplink(this.form)" type="button"> </form>
    Code (markup):
     
    adamjthompson, Feb 18, 2006 IP
  2. torunforever

    torunforever Peon

    Messages:
    414
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Repeat the <form></form> portions, but not the <script></script>. Keep only the first script section.
     
    torunforever, Feb 19, 2006 IP
  3. adamjthompson

    adamjthompson Well-Known Member

    Messages:
    1,242
    Likes Received:
    59
    Best Answers:
    0
    Trophy Points:
    125
    #3
    Hmmm. That's not working, as each form then has the same name. If I change the names of the second to forms, they don't reference to the script...
     
    adamjthompson, Feb 20, 2006 IP
  4. torunforever

    torunforever Peon

    Messages:
    414
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Oh yeah. I missed that. Here try this:

    <script language="JavaScript">
    // This script was found at www.skilton.net
    // and was written by Alex C. Skilton of acs.net
    // Please keep this notice as a courtesy
    function jumplink(acs, list) {
    loc=acs.elements[list].options[acs.elements[list].selectedIndex].value;
    location.href = loc
    }
    </script>
    <form name="acsform">
    
    <select name="acslist1"><option value="">Please Select:</option><option value="http://ww4.aitsafe.com/search?q=/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+Capsules+One+Time+Order&amp;price=42.16&amp;units=1">One Time Order: $42.16</option><option value="http://ww4.aitsafe.com/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+Capsules+Monthly+Order&amp;price=37.94&amp;units=1">Monthly Order: $37.94</option></select>
    <input value="Add to Cart" onclick="jumplink(this.form, 'acslist1')" type="button">
    
    </font></small></b><div align="center"><small><font face="Helvetica, Arial, sans-serif"><br>
    </font></small>
    <hr color="#000066" noshade="noshade" size="1" width="100%"><small><b><font face="Helvetica, Arial, sans-serif"><big>Bulk Powder<br>
    <br>
    </big></font><font color="#000066" face="Helvetica, Arial, sans-serif" size="-1">75 Gram Tub:</font></b></small><b><font face="Helvetica, Arial, sans-serif" size="-1"><br>
    
    <select name="acslist2"><option value="">Please Select:</option><option value="http://ww4.aitsafe.com/search?q=/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+75+Gram+Powder+One+Time+Order&amp;price=72.75&amp;units=1">One Time Order: $72.75</option><option value="http://ww4.aitsafe.com/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+75+Gram+Powder+Monthly+Order&amp;price=65.48&amp;units=1">Monthly Order: $65.48</option></select>
    <input value="Add to Cart" onclick="jumplink(this.form, 'acslist2')" type="button">
    </font></b><small><font face="Helvetica, Arial, sans-serif">
    <br>
    <b><font color="#000066">150 Gram Tub:</font><br>
    
    <select name="acslist3"><option value="">Please Select:</option><option value="http://ww4.aitsafe.com/search?q=/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+150+Gram+Powder+One+Time+Order&amp;price=132.25&amp;units=1">One Time Order: $132.25</option><option value="http://ww4.aitsafe.com/cf/add.cfm?userid=66142427&amp;product=Advanced+Glyconutrients+150+Gram+Powder+Monthly+Order&amp;price=119.03&amp;units=1">Monthly Order: $119.03</option></select>
    <input value="Add to Cart" onclick="jumplink(this.form, 'acslist3')" type="button">
    
    </form>
    Code (markup):
     
    torunforever, Feb 20, 2006 IP
    adamjthompson likes this.
  5. adamjthompson

    adamjthompson Well-Known Member

    Messages:
    1,242
    Likes Received:
    59
    Best Answers:
    0
    Trophy Points:
    125
    #5
    Thank you very much for your help. :)
     
    adamjthompson, Feb 20, 2006 IP