LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

Rep: Reputation: 30
dynamically add objects in JavaScript


hello,

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:

Code:
<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:

Code:
<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

<script>
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.

thanks,

djgerbavor3
 
Old 03-11-2005, 09:41 PM   #2
jonaskoelker
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.
 
  


Reply


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 09:10 AM.

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