|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Dynamic Table Header Text Change.
Greetings All...
I'm hoping someone can help me out here. I've created a Dynamic Table that appends to the end of the page using the appendChild method. Everything works well to my satisfaction for the table creation. Here's what I need help on. I have a text field that a user fills out with a onfocusout event attached to this textbox field. I want to change the text of "XXX" (shown below in the sampe) that resides in the dynamic table "th" cell to the value in the textbox. I can read the textbox no problem and get the value, but I just can't set that particular text of "XXX" to change to the new value from the textbox. Can anyone help me out with the proper method to call and the syntax of it. I would most appreciate it. Thanks Dan. Here's how I created the table... Note where the XXX is in bold, I want to change that dynamically to a value from the textbox. //* Create the basic table structure pd = document.getElementById('KeyRelationshipSection'); var tbl = pd.appendChild(document.createElement('table')); tbl.setAttribute("id",tableID + parentReference); var thead = tbl.appendChild(document.createElement('thead')); var tbody = tbl.appendChild(document.createElement('tbody')); /* Create the header row */ var tr = thead.appendChild(document.createElement('tr')); var th1 = tr.appendChild(document.createElement('th')); th1.appendChild(document.createTextNode(" ")); var th2 = tr.appendChild(document.createElement('th')); th2.appendChild(document.createTextNode("Business Unit Name: ")); var th3 = tr.appendChild(document.createElement('th')); th3.appendChild(document.createTextNode("XXX")); var th4 = tr.appendChild(document.createElement('th')); th4.appendChild(document.createTextNode(" ")); |
|
#2
|
||||
|
||||
|
Not an answer to your question, but - AFAIK, onfocusout is not a standard event handler. It sounds very Microsoft-based to me... meaning it won't work on anything other than IE.
|
|
#3
|
||||
|
||||
|
You can put your text in a DIV within the th tag and use js to change the value using something like the following:
Code:
<script language="javascript">
function change(div_id,val){
elm=document.getElementById(div_id);
elm.innerHTML=val;
}
</script>
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Dynamic Table Header Text Change. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|