Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use innerHTML to place textbox or select list ?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,
I have problem in using innerHTML in DHTML ?
Depending on user selects from a group of radio buttons,
I am displaying different texts by using innerHTML !!
But i want to display select list or textarea or tables !!
How can i do that ? is it possible using innerHTML !!

I appreciate for your help !!

Krishna
 
1. yes it should be possible, but
2. from memory will only work in IE, and
3. should post this on the Javascript forum. codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
Like this?
Code:
function fillSpan(num){
   if(num==0){
      spanReference.innerHTML = &quot;<select name='selTest'><option value='1'>1</option><optiona value='2'>2</option></select>
   }
   else{
      spanReference.innerHTML = &quot;<textarea name='txtTest'>My textarea</textarea>&quot;
   }
}

Change the spanReference to the reference of your tag (document.whatever.whatever). The code is rough, but whatever string you enter into the innerHTML is parsed as HTML so you can assign it just like any other string.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Tarwn,

You got it.. except.. (and only because you pointed out Onpnts mistake).. you forgot to close your quotes in the first spanReference. :p

Cheers,

G.
 
Heh :) thanks, I'm not exaclty awake today either :)
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top