Current location: Hot Scripts Forums » General Web Coding » JavaScript » HTML in a string


HTML in a string

Reply
  #1 (permalink)  
Old 12-07-05, 01:03 PM
dracula dracula is offline
Newbie Coder
 
Join Date: Aug 2005
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
HTML in a string

say i have HTML stored in a string called "contents" and i want to put it in a div with the id "container"

contents = '<input type="text" name="input" />';
document.getElementById('container').innerHTML = contents;

ive always set the value of an input after its displayed, because i can easily identify it... but this creates a little lag (the text flashes)... so i was wondering if there is a way to set the input's value before displaying it (while its still a string)

thanks,
dracula
Reply With Quote
  #2 (permalink)  
Old 12-07-05, 05:23 PM
dracula dracula is offline
Newbie Coder
 
Join Date: Aug 2005
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
And another unrelated inquiry,

I'd like to append text directly after an element... is there any way of doing this without containing it somehow?
Reply With Quote
  #3 (permalink)  
Old 12-14-05, 08:06 AM
ranbla ranbla is offline
Newbie Coder
 
Join Date: Aug 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by dracula
say i have HTML stored in a string called "contents" and i want to put it in a div with the id "container"

contents = '<input type="text" name="input" />';
document.getElementById('container').innerHTML = contents;

ive always set the value of an input after its displayed, because i can easily identify it... but this creates a little lag (the text flashes)... so i was wondering if there is a way to set the input's value before displaying it (while its still a string)

thanks,
dracula
Use the value parameter of the input tag to set the value.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
html tutoral thefrtman HTML/XHTML/XML 5 04-27-09 10:25 AM
help to turn a filelist in to a winamp playlist mike-wigan Windows .NET Programming 0 10-18-05 11:10 AM
Converting a String into HTML for an image link. Rusty Ranchero ASP 5 05-31-05 05:40 PM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM


All times are GMT -5. The time now is 10:59 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.