Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) 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
 
Old December 26th, 2005, 08:12 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default give checkbox value

hello again
can we give checkbox value for check or uncheck in this way?would you please tell me what is wrong with it?
i placed a button(check all button)and i want to check all my checkboxes with clicking the button

<input type="button" Name="CheckAll">
<script for="CheckAll" language="vbscript" event="onclick">

document.formname.checkboxname.value="1"



                </script>


 
Old December 27th, 2005, 05:32 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You need to loop through the Form collection and diagnose each control. When it's a check box, set its checked property:

function CheckAll()
{
  for (var i = 0; i < document.MyForm.elements.length; i++)
  {
    if(document.MyForm.elements[i].type == 'checkbox')
    {
      document.MyForm.elements[i].checked = true
    }
  }
}

It's JavaScript, but the same principle applies to VBScript.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 28th, 2005, 01:20 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

thank you Imar.it is working now and i learned a very usefull thing






Similar Threads
Thread Thread Starter Forum Replies Last Post
Please give me solution deepak.deemca C++ Programming 1 October 17th, 2007 04:27 PM
please give me a help wujilin SQL Server 2005 2 June 2nd, 2007 04:33 PM
please give me a help wujilin SQL Language 2 May 28th, 2007 07:52 AM
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 03:41 PM
How to give the value to a where - between san22 Pro VB.NET 2002/2003 1 May 5th, 2006 11:55 AM





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