Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2004, 10:46 PM
Authorized User
 
Join Date: Sep 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Invoke onClick() function when body onLoad

I have a onclick event which working well in my html tag

Code:
<td id="row" onClick="showAlert(); return"></td>
When onclick, an alert message will be popup.

So, is it possible that we could invoke this onClick event without explicitly have to click on the <td> object? For instance, when the body onLoad, write something so that the <td> object will invoke the onclick event itself?

 
Old November 10th, 2004, 02:04 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hiii Muklee
Try to do this
<script>
function showAlert()
{ alert("test-muklee");
}
function test()
{
obj=document.getElementById("row")
obj.click();
}
</script>
<body onload="test()">
<table><tr>
<td id="row" onClick="showAlert();">TableData</td>
</tr>
</table>
</body>
Hope It will solve your question.
Cheers :)

vinod
 
Old March 16th, 2007, 01:02 AM
Registered User
 
Join Date: Mar 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks a lot it is working!!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
onload function calll tannu Ajax 1 November 21st, 2006 01:15 PM
Double DB insert using body.onload needlz BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 February 20th, 2006 04:18 PM
Problems with Body onload event blaabil Javascript How-To 0 January 6th, 2006 06:45 AM
How to use Onclick function for this jaya2109 BOOK: Beginning ASP 3.0 5 June 22nd, 2004 07:28 AM
Body Onload Function Question apd8x Javascript 2 July 10th, 2003 02:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.