Hello, I'm having a big problem trying to get a javascript function to click a button to submit a page in IE. I *think* it may be related to Windows XP SP2, but I'm not sure. Here's what doesn't work. If I try to click the link, the page submits to the root of the website. Not to the page specified in the <form> tag. Here's an example:
However, I can get this to work if I don't call the ClickButton() function through an anchor tag. For instance, this always works:
Can anyone tell me how to fix the first set of code?
Thank you VERY MUCH for your help!
Steve
Code:
<input type="submit" name="btnSubmitMe" value="Click Me" id="btnSubmitMe" />
<br>
<a href="" onclick="javascript:ClickButton()">Click me to submit the page through clicking the button</a>
<script language="javascript" type="text/javascript">
function ClickButton() {
document.Form1.btnSubmitMe.click()
}
</script>
However, I can get this to work if I don't call the ClickButton() function through an anchor tag. For instance, this always works:
Code:
<input type="submit" name="btnSubmitMe" value="Click Me" id="btnSubmitMe" />
<br>
<script language="javascript" type="text/javascript">
ClickButton()
function ClickButton() {
document.Form1.btnSubmitMe.click()
}
</script>
Can anyone tell me how to fix the first set of code?
Thank you VERY MUCH for your help!
Steve