Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple if...then q 1

Status
Not open for further replies.

thompom

Technical User
Joined
Dec 4, 2006
Messages
395
Location
GB
hi,

can you help me make this statement work-
logic:

if makeselect = SAAB then geturl(saabsite) target = blank
else
if makeselect <> nothing then usedurl = stuff
if priceselect <> nothing then usedurl = stuff
if priceselect = nothing AND makeselect = nothing then
usedurl = stuff
geturl(usedurl) target=self
end if

code:
Code:
if (makeselect.data = "SAAB") {
getURL("saabsite");
}
else
{
if (makeselect.data <> undefined) {
usedurl = usedurl + "&z_Make==,','&x_make="+ makeselect.data; 
}

if (priceselect.data <> undefined) {
usedurl = usedurl + "&x_price="+priceselect.data; 
}

if (priceselect.data == undefined && makeselect.data == undefined) {
usedurl = usedurl + "&cmd=resetall"
}

getURL(usedurl);
}
 
What exactly is makeselect?

if it is a <select> box, instead give it an id

<select id="makeselect"> and reference the value with .value

Do the same with priceselect.
Code:
var carSelect = document.getElementById("makeselect").value;
if (carSelect [!]=[/!]= "SAAB") {
getURL("saabsite");
}
else
{
if (carSelect.length) {
usedurl = usedurl + "&z_Make[s]=[/s]=,','&x_make="+ carSelect; 
}
... same idea with priceselect

Also, don't forget == on you if statements.

[monkey][snake] <.
 
many thanks...again
 
Use also != instead of <>

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top