Hi Everyone,
Quick JavaScript question.
I have a form which has two submit buttons, with either one hidden dependant on the value of a form field (radio button), this works fine when switching between the radio button values but I also want the function to fire onload when the form is reloaded, which occurrs when a user comes back to this page/form from another page/form. The reatining of the field value is working fine, just having some problems with the onload bit.
Code so far:
--------------
//Javascript used (and works)for onclick of radio buttons
function SetButtonLabelGSTCopy2(obj)
{
if(obj.value == "Yes")
{
document.getElementById("GSTButton").className="hidden";
document.getElementById("SubmitButton").className="show";
} else if (obj.value == "No")
{
document.getElementById("GSTButton").className="show";
document.getElementById("SubmitButton").className="hidden";
}
}
--------------
html
<input type="radio" name="Q2B6" value="Yes" id="Q2B6" onclick="SetButtonLabelGSTCopy2(this);" />
<input type="radio" name="Q2B6" value="No" id="Q2B6" onclick="SetButtonLabelGSTCopy2(this);" />
<input name="GSTButton" type="submit" id="GSTButton" onclick="diary.action='copyright_gst.asp'; return true;" value="Go to Confirmation of GST Treatment Form">
<input name="SubmitButton" type="submit" id="SubmitButton" onclick="diary.action='copyright_send.asp'; return true;" value="Submit Copyright Licence Request Order Form">
----------------
How can I fire this check onload as well?
Thanks