how to code/programatically fake a button click
any ideas. ie I want to programatically activate the onClick() function I've written without actually clicking on the button.
You can just call it like any other method -
thanks. That is what I was doing but for some reason, it appears the screen does not refresh properly the first time I call the onclick() from another function, but it does if I actually click on the button vs calling the function from another function that is executed.
I put alerts in etc in the function and it appears as though it is executing. I am using it on the <body onload=mybutton.onClick()> call.
and it contains http.requests
Why dont you put what is in the onClick in a new function, and you call that instead, and in the onClick, you do the same.
what you do now is:
onload = button.click = your stuff
button.click = your stuff
waht you should try is:
onload = myfunction
onclick = myfunction
myfunction = your stuff
thanks I tried that.
The function does set a couple of display="block" and display="none" .
it may be these were not initially defined
it seems to have something to do with initial load of page.
Here is a little chunk of code. as you can see the mystartup is called and is also called when mygetbutton.onClick() is called.
<input type="hidden" name="date3" id="sel3" size="10">
<div id="contentaccess" style="position:absolute; left:180; top:130">
<div id="contentcontact" style="position:absolute; left:180; top:130">
<div id="contentnotify" style="position:absolute; border: 1px solid #aaa; left:185; top:153; width:540; height: 370">
<div id="content" style="position:absolute; left:180; top:130">
<span id="myTabs" style="position:absolute; left:185; top:130; width:545; height: 400"></span>
<!-- insert control tags -->
<!-- create controls -->
Maybe you need to add some delay as the grid may not be yet fully initialized during window.onload event.
That did it.
I put in a setTimeout call and set it at 1500, before calling my function.
This works for now. Is there any other way to control this. I expect this may very from client to client.
thanks. great product