Community Forums 

Main Content

How to change image during choose of product from drop down menu

    Jul 25 2016 17:31:48

    #1

    GT

    Join date : 2008-09-18      Posts : 3207

    As the script is breaking the productpr value at the colon and using the value after the colon, you do not need to use productpr, change it all back to the select name as before.

    Having trouble with a form or need one building?
    Fast turnaround, but I do charge :)

    Mal's Forms / Scripts and the syntax are here.




    Jul 25 2016 17:40:25

    #2

    Tomele

    Join date : 2016-07-11      Posts : 23

    GT said As the script is breaking the productpr value at the colon and using the value after the colon, you do not need to use productpr, change it all back to the select name as before.

    Yes, but then we come back to the original question, because next variation wont work: document.images['pic'].src='images/'+this.options[this.selectedIndex].value+'.jpg'

    becouse price value detected like a continue of image name <option value="Silver_Metallic_colour :16.00 "> and this function (change image onclick) not working.

    So, the questions is - how to separate image name and price value here ...document.images['pic'].src='images/'+this.options[this.selectedIndex].value+'.jpg' ...



    Jul 25 2016 17:52:19

    #3

    GT

    Join date : 2008-09-18      Posts : 3207

    Ask the person who built the script for you.

    Having trouble with a form or need one building?
    Fast turnaround, but I do charge :)

    Mal's Forms / Scripts and the syntax are here.




    Jul 25 2016 18:11:52

    #4

    Tomele

    Join date : 2016-07-11      Posts : 23

    Hi Geoff,

    How to separate image name and price value here ...document.images['pic'].src='images/'+this.options[this.selectedIndex].value+'.jpg' ...

    for

    <option value="Gold_Metallic_colour:3.00">Gold Metallic - 3</option>


    Thank you!



    Jul 25 2016 18:58:52

    #5

    Geoff

    Join date : 2008-09-18      Posts : 415

    ...document.images['pic'].src = 'images/' + this.options[this.selectedIndex].value.substr(0, this.options[this.selectedIndex].value.indexOf(':')) + '.jpg'...



    Jul 25 2016 19:22:33

    #6

    Tomele

    Join date : 2016-07-11      Posts : 23

    Geoff said ...document.images['pic'].src = 'images/' + this.options[this.selectedIndex].value.substr(0, this.options[this.selectedIndex].value.indexOf(':')) + '.jpg'...

    Dear Geoff, thanks a lot!



       «      1   |   2