3.2.0

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.

thanks.
Jeff
August 1,
You can just call it like any other method -

button.onClick();
Alex (ActiveWidgets)
August 1,
Alex,

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

any ideas.

thanks.

Jeff
Jeff
August 3,
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
Patrick
August 3,
Patrick,

thanks I tried that.

Could it be something to do with the fact I have a couple of DIV and SPAN tags defined after the javascripts and <body onload> call and.

Jeff

I'll try defining divs prior to load of javascript and <Body onLoad=myfunction()> tag.

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.


<BODY onLoad="mystartup();">


<input type="hidden" name="date3" id="sel3" size="10">
<div id="contentaccess" style="position:absolute; left:180; top:130">
</div>
<div id="contentcontact" style="position:absolute; left:180; top:130">
</div>
<div id="contentnotify" style="position:absolute; border: 1px solid #aaa; left:185; top:153; width:540; height: 370">
</div>
<div id="content" style="position:absolute; left:180; top:130">
</div>
<span id="myTabs" style="position:absolute; left:185; top:130; width:545; height: 400"></span>


<p><br></p>

<!-- insert control tags -->
<span id="myTabs"></span>
<!-- create controls -->

</body>

<p><br></p>

</html>
Jeff
August 3,
Maybe you need to add some delay as the grid may not be yet fully initialized during window.onload event.
Alex (ActiveWidgets)
August 4,
Alex,

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.

your thoughts.

thanks. great product

Jeff
Jeff
August 5,

This topic is archived.

See also:


Back to support forum