Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-21-2005, 04:05 PM   #1
Registered: Jun 2004
Location: PA
Distribution: Fedora (latest git kernel)
Posts: 451

Rep: Reputation: 30
dynamically add objects in JavaScript


i have a form and when a user hits a certain radio button. I want a certain piece of html code to run. For example:

<input type='radio' value=0 name='myradio'>1
<input type='radio value =0 name='myradio'>2
now i want to add javascript to add a certain drop down menu depending on what radio button they selected, this is what i have so far:

<input type='radio' value=0 name='myradio' onclick = document.myform.myradio.value = 1>1
<input type='radio' value=0 name='myradio' onclick = document.myform.myradio.value=2>2

if(docuemnt.myform.myradio.value == 1) {
        write code
else {
        some other code
when i load this page, i get an errory saying that document.myform.myradio.value is either null or not an object.

My question is how can dynamically create html code, when a user select a radio button. Remind you that each radio button will produce different html code.


Old 03-11-2005, 09:41 PM   #2
Senior Member
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 46
have a look at span or div tags and their innerHTML-attributes. It may (or may not) help.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
java objects zaicheke Programming 3 03-23-2005 06:21 AM
Dynamically sized objects in shared memory jtshaw Programming 2 03-16-2005 10:12 AM
dynamically phoenix_fei Programming 5 01-17-2005 07:51 PM
lost objects gurra59 Linux - Newbie 4 09-07-2003 04:29 PM
Objects in Java? mikeshn Programming 0 06-11-2002 10:21 AM

All times are GMT -5. The time now is 06:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration