First off, I apologise for being stupid and I previously posted this in the DOM section but had no luck with any replies.
My skills with JavaScript are limited to adapting existing code only
I have a calculator which generates values within a form, using "
onChange" calls to a function.
I want to provide links to matching products depending on the calculated result and have added
If..Else..If.. to the function to produce a URL where the result is matched within number ranges.
I cannot get this result to be a clickable link - I'm sure it is a simple thing to do but I've tried a few things and am not even close!
Page is here:
http://www.homesupply.co.uk/radcalc99.php
I've added the following code:
Code:
if (answer==undefined)
{
lnk="products.php?cat=581&opt=,Various";
}
else if (answer<500)
{
lnk="products.php?cat=581&opt=,Less than 500";
}
else if (answer>499 && answer<750)
{
lnk="products.php?cat=581&opt=,500-749";
}
else if (answer>749 && answer<1000)
{
lnk="products.php?cat=581&opt=,750-999";
}
else if (answer>999 && answer<1401)
{
lnk="products.php?cat=581&opt=,1000-1400";
}else if (answer>1400)
{
lnk="products.php?cat=581&opt=,Over 1400";
}
document.theForm.dlnk.value =(lnk);
}
And also:
Code:
<input type="button" name="dlnk" size="20" value="" class="total" />
Any assistance would be very welcome!