PDA

View Full Version : help! i need somebody.. (js onclick set var)


mwijbenga
02-26-2004, 11:09 AM
Hello,

I'm trying to set and read the value of a javascript variable 'a href'. What i want to do is: when somebody clicks on the link, it sets the value of a var called ActiveCat and reads the value of a var called ActiveIcon

So itīll be something like href="javascript:SetActiveCat('zoeken', ActiveIcon);"

Zoeken has to be set so that i can use that later on and ActiveIcon has to be read, and if its empty it also has to do something..

I have written the following function:

function SetActiveCat(ActiveCat, ActiveIcon)
{
if (ActiveCat == "zoeken")
{
if (ActiveIcon == "") {
parent.contentFrame.location.href = '../lib/auto/zoeken_auto.php?categorie=3';
}
else if (ActiveIcon == "bedrijfswagen") {
parent.contentFrame.location.href = '../lib/bedrijfswagen/zoeken_bedrijfswagen.php?categorie=4';
}
}
else
{
if (ActiveIcon == "") {
parent.contentFrame.location.href = '../lib/auto/aanbieden_auto.php?categorie=3';
}
else if (ActiveIcon == "bedrijfswagen") {
parent.contentFrame.location.href = '../lib/bedrijfswagen/aanbieden_bedrijfswagen.php?categorie=4';
}
}
}


now when the link is clicked it should go into the function and open a page in another frame, this works, but i also have some other links, and they should read what just got set by the click action and with that info it should also go into the function and should read what kind of link they should go to. It sounds complex i hope you understand, please tell me how to do this.

agent002
02-26-2004, 11:48 AM
This question builds on your other questions here, now why did you make a new thread for it?