Wednesday, November 24, 2010

How can I make the entries in 2 lists change the link of a button on my website?

I have 2 lists that depending on their values will lead to different links but I want to always be able to press 1 button.



for example:



list 1 value = red

list 2 value = boat

press the send to site button and you get sent to RedBoat.com



now change values to

list 1 value = blue

list 2 value = car

press send to website button and get sent to BlueCar.comHow can I make the entries in 2 lists change the link of a button on my website?I don't know whether you are actually changing the values of the list or not. I don't really need to know that though.



To get the one button to be able to do what you want, I would use JavaScript and do something like this:



function buttonPress() // Call it whatever you want.

{

if (typeof buttonPress.value1 == %26quot;undefined%26quot;) // Checks whether you have set a value to value1 or not. A value would not have been set on the first call to this function.

{

buttonPress.value1 = %26quot;red%26quot;;

buttonPress.value2 = %26quot;boat%26quot;;

}

else if (typeof buttonPress.value1 == %26quot;red%26quot;)

{

buttonPress.value1 = %26quot;blue%26quot;;

buttonPress.value2 = %26quot;car%26quot;;

}

// Then combine the two values and the %26quot;.com%26quot;

// Send the person to the website.

}



Note, I have not tried this, so I don't know if it will work. You may need to test it and make some changes for it to work as you want.