Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Ajax
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Ajax the combination of XHTML, CSS, DOM, XML, XSLT, XMLHttpRequest, and JavaScript
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ajax section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 2nd, 2009, 12:55 AM
Friend of Wrox
Join Date: Oct 2004
Location: , , .
Posts: 198
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via MSN to itHighway
Default Ajax - Creating checkboxes

Using Ajax below is how we create HTML SELECT box.

if (xmlHttp.readyState == 4)
if (xmlHttp.status == 200)
var result = xmlHttp.responseText;
var values = result.split("|");

for (var i=0; i<values.length; i++)
var newOption = document.createElement('option');
newOption.value = values[i];
newOption.text = values[i]; // Mozilla specific


What is the procedure of creating CHECK BOXES?? I want to show City name along with checkbox.
Reply With Quote
  #2 (permalink)  
Old April 2nd, 2009, 04:06 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

I don't see that this is an Ajax question at all but on most modern browsers (there used to be a problem with IE over this) you can do something like:
for (var i=0; i<values.length; i++)
  var chk = document.createElement("input");
  chk.type = "checkbox";
  var id = "chkCity" + i;
  chk.id = id;
  chk.name = id;
  var lbl = document.createElement("label");
  label.innerHTML = values[i];
  label.htmlFor = id;
You may also need to create and append a br element depending on the layout you want.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recommend an AJAX IDE - JoyiStar AJAX WebShop. kingstar Ajax 4 December 15th, 2006 05:12 AM
creating checkboxes at runtime abhishekdubey_997 ASP.NET 1.0 and 1.1 Basics 14 November 24th, 2006 01:56 AM
New Ajax article: Creating an Ajax Search W jminatel BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 May 11th, 2006 03:45 PM
new Ajax article: Creating an Ajax Search Widget jminatel Ajax 0 May 11th, 2006 02:50 PM
New Ajax Article: Ajax Submission Throttling jminatel Ajax 0 April 11th, 2006 08:00 PM

All times are GMT -4. The time now is 11:45 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.