473,786 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can we add function to textbox in dynamic table.

9 New Member
Hi all,
I am working on Dynamic table.
I am creating the new row each time by using add button.
But i in each row i am adding new text boxes, i want to add function to
these textboxes like onclick="dosome fuction()" like this.
The code look like this:

Expand|Select|Wrap|Line Numbers
  1. function createNewTextBox(){ 
  2. var myTable=document.getElementById('myTable'); 
  3. var plastron=myTable.rows.length; 
  4. var rows = myTable.getElementsByTagName('tr'); 
  5. var cels = rows[plastron-1].getElementsByTagName('td'); 
  6. var row = myTable.insertRow(plastron); 
  7. var cell = row.insertCell(1); 
  8. var el = document.createElement('input'); 
  9. else('type', 'text'); 
  10. else('name','myName'); 
  11. else('value', ''); 
  12. else('size', '10'); 
  13. else('maxLength', '10'); 
  14. el.onchange = function (evt) { anyFunctionThisTextBoxMightNeed() };
  15. cell.appendChild(el);
  16.  
el.onchange = function (evt) { anyFunctionThis TextBoxMightNee d() };
In this perticular line i have added my function just like this,
el.onchange = function (welcome) { alert("Welcome" ); };

But code is not working.
Please help me!!

Thanks in advance.
Nov 25 '08 #1
5 1950
acoder
16,027 Recognized Expert Moderator MVP
When you say it's not working, is there an error?

Are you trying to alert the passed variable?
Nov 25 '08 #2
vinodsk101
9 New Member
No i am not passing any value. I just declared the function name and method.
Its just telling object required error.
Basically i want to add function to all textbox in table.
Cau you tell me that, whether the code is proper or not!
Nov 25 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
Try:
Expand|Select|Wrap|Line Numbers
  1. el.onchange = function () { alert("Welcome"); };
Nov 25 '08 #4
vinodsk101
9 New Member
Thank you its working.
Nov 26 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
Glad it is! You're welcome, of course.
Nov 26 '08 #6

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

Similar topics

2
7403
by: Hennie de Nooijer | last post by:
Hi i have a problem i have the following Trans SQL statement in a function SET @desc= (Select description From table Where id = @id) Now i want to make table dynamic. Something like this SET @desc= (Select description From @table Where id = @id) Yeah yeah i know i can't do this:
1
9903
by: Not Me | last post by:
Hi, I'm sure this is a common problem.. to create a single field from a whole column, where each row would be separated by a comma. I can do this for a specified table, and column.. and I've created a function using VBA to achieve a more dynamic (and very slow) solution.. so I would like to implement it using a user defined function in sql server. The problems I'm facing are, that I can't use dynamic sql in a
4
2724
by: DaKoadMunky | last post by:
I was recently looking at some assembly code generated by my compiler. When examining the assembly code associated with constructors I noticed that the dynamic-dispatch mechanism was enabled before member initialization but after base initialization. To speak in implementation details the virtual function table pointer for objects being constructed was set before member initialization but after base initialization. Curiousity then...
0
1135
by: mm | last post by:
Hi, Is it true that we can use dynamic SQLs in external user-defined scalar functions but not in table functions? I saw an example of "dynamic SQL in an external scalar function" in a sample file coming with DB2 (the Convert() function in the file sqllib/samples/c/udfemsrv.sqc). I tried to write a table function in C which executes dynamic SQLs to
16
5189
by: mj.redfox.mj | last post by:
Can anyone help? I have a textbox which I'm programatically adding by using the following code: txtTest = New TextBox txtTest.ID = "txtLeft" + cntCount.ToString Page.FindControl("tdInput").Controls.Add(txtTest) This successfully creates a textbox called "txtLeft1" in the table
0
3506
by: sjickells | last post by:
Hi I am having a problem using asp:TextBox's in a transparent table. I have a background image on the page and a table in the middle of the page. I have set the background colour of the table to white the used CSS to set the opacity to 90 so that you can see the background image through the table. The problem I am having is with the textboxes in the transparent
4
12539
by: anniebai | last post by:
Please help me with writing a RowUpdating function in C#, I don't know how to grab the current field's value and also get the old value for one of keys (which is ProjectName for editing) of the selected row. I've tried: e.Keys.Count, e.OldValues.Count, e.NewValues.Count -----------> all give zero Some said if TemplateField is used, e.Keys and Oldvalues, NewValues are all empty. Then what suppose to be used in such case? Thanks for any...
0
4063
by: troydixon | last post by:
Hello, I am new at this, and have been trying to insert data into a table by using the footer of a gridview (which I dont like) or by using a detials view on the same page that is doing the following: 1) gets query string from url and filters records (works great) via a Details View 2) shows notes that have been added to the record shown in the details view using a grid view, and it filters the data by looking at the ID that is selected in...
17
2945
by: Shalini Bhalla | last post by:
i have 2 tables bank master and branch details having bankcode as a common feild . i have designed a form in which i am filtering branches according to a particular bank code using ajax , i an fine till this ..... now i want that fields of these records should come in a separate field so that i can change my data there itselfe and using ajax can update database on onblur event ...... how to do this ? this is my code for...
0
9497
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
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9962
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...
0
6748
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();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
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
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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.