SunQuest
 
           JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old April 15th, 2004, 09:34 AM
boy3696 boy3696 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 boy3696 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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(" "));

Reply With Quote
  #2  
Old April 16th, 2004, 12:02 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
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.
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old April 16th, 2004, 07:24 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Dynamic Table Header Text Change.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway