473,624 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to add an onclick attribute to a tr created with insertRow

1 New Member
I created a row using insertRow:

r = tbl.insertRow() ;

and I want to be able to add an onclick handle to that row.

Does any one know how to do this?

BTW I've tried

r.onclick = alert()

and it does not work. It only gives me an alert when the row is created not when it is clicked.
Apr 12 '07 #1
1 2599
Romulo NF
54 New Member
I created a row using insertRow:

r = tbl.insertRow() ;

and I want to be able to add an onclick handle to that row.

Does any one know how to do this?

BTW I've tried

r.onclick = alert()

and it does not work. It only gives me an alert when the row is created not when it is clicked.
can you post this function that you use the create the rows?
Apr 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
39446
by: Dipin | last post by:
Hi All; I have this javascript which is adding a new button to the column in the row which is created dynamically, the innerhtml shows that the onclick event is correctly added but it never gets invoked when I click it. newcol = doc.createElement("TD"); newbutton = doc.createElement("input"); newbutton.name = "newChange"+__uid;
2
18561
by: RobG | last post by:
I am trying to dynamically add an onclick to an element, however I just can't get the syntax right. consider the following function: function doClick (evt,x) { // do things with evt and x } Which is called statically by: <button onclick="doClick(event,this);">Click me</button>
5
17684
by: johnsuth | last post by:
I want to produce a trivial demonstration of dynamic modification. I thought that pressing a button might change its color. I studied O'Reillys books and successfully created the button with a fancy style, but the onclick fails to do anything no matter what permutation of parameters I try. <input type=button style=background-color:yellow;color:blue;font-family:Arial;font-style:italic;font-weight:bold name="xyz" value="CHANGE COLOUR"...
2
3279
by: Sedef | last post by:
Hi, i'm trying to create a custom Button user control which will be derived from System.Web.UI.WebControls.Button. the normal server side Button class creates some client side javascript code for its onclick event. it's something like: <input type="submit" name="Button1" value="Button" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="Button1" /> what i want to do is to be able to...
2
8047
by: Peter | last post by:
Hi, this is the code, and new row and new cell generated ok, but why the onclick and onmouseover doen't work? Thank you in advance! <html> <head> <script language="javascript"> function inserttable() {
5
6481
by: Jason | last post by:
Hello, I am trying to dynamically create a table, then set its <td>'s onclick: var table = document.createElement("table"); var row = table.insertRow(-1); var td = row.insertCell(-1); td.onclick = myfunction; function myfunction(event) { alert(event);
4
3664
by: donpro | last post by:
Hi, I've created a table where the header columns link to an AJAX function which calls a PHP file and returns content - the purpose is to sort the table on the heading. The code snippet is: <th scope="col"><a href="javascript:;" onclick="loadBookingContent('<? php echo $SERVERPAGE_URL . SORT_BY_BOOKING; ?>','innerhbl')">Booking</ a></th>
3
1124
by: COHENMARVIN | last post by:
I created asp.net pages that contained several controls, including buttons. I would double click on the button, and this would take me to the 'code-behind' page, and create the shell of a routine to handle that button click. What I found later though, was that this routine was being executed twice. So I looked into it, and I found that the button had a 'onclick' attribute which was pointing to the routine, but also, the routine had a...
17
2666
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/this-alert.html http://www.frostjedi.com/terra/scripts/demo/this-alert2.html Why, when you click in the black box, do the alert boxes say different things? Shouldn't they say the same thing?
0
8168
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8614
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8330
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.