...

View Full Version : onclick="setAction(..." does not redirect



thosecars82
01-04-2010, 06:33 PM
Hello
I have this really simple form.

<form name="cac" id="cacid" method="POST">
<input type="submit" value="Go to google"
onclick="setAction('http://www.google.es')"/>
</form>

Why doesn't it go to www.google.es when the submit button is clicked?Thanks in advance

thosecars82
01-04-2010, 07:04 PM
Hello
I have this really simple form.

<form name="cac" id="cacid" method="POST">
<input type="submit" value="Go to google"
onclick="setAction('http://www.google.es')"/>
</form>

Why doesn't it go to www.google.es when the submit button is clicked?Thanks in advance

Solved, the id was not correct according to my javascript function:
function setAction(action)
{
var txt="";
try{
document.getElementById('cac2id').action = action;
}catch(err){
txt = "Error in function setAction() with description:" . err.description;
alert(txt);
}
return true;
}
Therefore, I just put cac2id in the id tag and it is solved.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum