Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to create Check Box and Select Tag

Reply
Thread Tools

How to create Check Box and Select Tag

 
 
Raghuram Banda
Guest
Posts: n/a
 
      09-11-2003
Hi there,

I'm new programmer in JavaScript. Can any one help in creating a
checkbox (by default selected) from JavaScript and creating Drop down
box (<select> ... </select>) from Javascript.

Thanks In Advance

 
Reply With Quote
 
 
 
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      09-11-2003
Raghuram Banda <(E-Mail Removed)> writes:

> I'm new programmer in JavaScript. Can any one help in creating a
> checkbox (by default selected) from JavaScript


var cb = document.createElement("input"); // create input node
cb.type = "checkbox"; // set type
cb.name = "checkboxName"; // set name if necessary
cb.checked = cb.defaultChecked = true; // make it checked now and by default

formRef.appendChild(cb); // add it to some form

> and creating Drop down
> box (<select> ... </select>) from Javascript.


var se = document.createElement("select");
cb.name = "selectName";
se.options[0] = new Option("selection 1","value 1");
se.options[1] = new Option("selection 2","value 2");
se.options[2] = new Option("selection 3","value 3");
se.options[3] = new Option("selection 4","value 4");

formRef.appendChild(se);

Hope this helps.
/L
--
Lasse Reichstein Nielsen - http://www.velocityreviews.com/forums/(E-Mail Removed)
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
how to selecet check box in the data grid ?? only one check box mit ASP .Net 1 01-25-2006 06:47 PM
<select tag> - how do I set the current index in a multiple select box? Ferd Berfel Javascript 4 04-06-2004 06:53 PM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM



Advertisments