I am trying to get a URL to be made up from the choice of select items using chained selects so the options are not shown here as they are generated from the chained select script. there are also some hidden fields as shown. What I have so far is;
And then the javascript ofHTML Code:<form name="item"> <input type="hidden" name="itemtitle" id="itemtitle" value="mytitle"> <input type="hidden" name="itemid" name="itemid" value="123456789"> <fieldset> <h4>Style:</h4> <select name="style" id="itemstyle" onchange="mylink();"></select> <h4>Colour:</h4> <select name="color" id="itemcolor" onchange="mylink();"></select> <h4>Size:</h4> <select name="size" id="itemsize" onchange="mylink();"></select> </fieldset> <fieldset> <h3>Price <span id="itemprice">$50.00 each</span></h3> <label for="itemqty">Quantity</label> <input type="text" maxlength="5" value="1" id="itemqty" name="itemqty" onchange="itemprice();" size="6"> </fieldset> </form> <p class="right"><a href="http://www.mysite.com/productname-123456789?style=basic&color=white&size=350ml" id="itemlink"><img src="/themes/mysite/images/additem.png"></a></p>
is my code above wrong, if so where and what is the correct code please.Code:function mylink(){ var itemlink = 'http://www.mysite.com/productname-123456789?style=basic&color=white&size=350ml'; var myurl = 'mmm.mysite.com'; var mystyle = document.getElementById('itemstyle').value; var mycolor = document.getElementById('itemcolor').value; var mysize = document.getElementById('itemsize').value; var myTitle = document.getElementById('itemtitle').value; var myId = document.getElementById('itemid').value; document.getElementById('itemlink').href='http://'+myurl+'/'+myTitle+'_'+myId+'&style='+mystyle+'&color='+mycolor+'&size='+mysize;
Thanks
GW



I like Smilies
Reply With Quote


Bookmarks