473,785 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onClick onUnClick ???

The code shown below displays a table in a form with 3 check boxes.
When the left checkbox is selected, all other checkboxes are also
selected (hotmail style) (thanks for the groups help with this). The
onUnCick event doesn't work. Could anyone tell me how to correct it??

Thanks,

Ed

<html>
<head>
<title></title>
</head>
<body>

<form name=taskform action=test.php method=post>

<script language="JavaS cript">
<!--
var row_1 = new Array("Monday0" , "Monday1")
function check_boxes1(st ate)
{
for (y=0; y < row_1.length; y++)
{
for (i = 0; i < document.taskfo rm.elements.len gth; i++)
{
if (document.taskf orm.elements[i].name == row_1[y])
document.taskfo rm.elements[i].checked = state;
}
}
}
--> </script>

<table border=1 width=85%>
<tr>
<td class=small>Che ck increment</td>
<td class=small>tog gle</td>
<td class=small>0:0 0</td><td class=small>1:0 0</td>
</tr>
<tr>
<td class=small>on the hour</td>
<td><input type=checkbox name=checkall_r ow1
onClick="check_ boxes1(true)" onUnClick="chec k_boxes1(false) "></td>
<td><input type=checkbox name=Monday0></td>
<td><input type=checkbox name=Monday1></td>
</tr>
</table>
</form>
</body>
</html>
Jul 20 '05 #1
6 8384
"Edward" <eg****@hotmail .com> wrote in message
news:58******** *************** ***@posting.goo gle.com...
The code shown below displays a table in a form with 3 check boxes.
When the left checkbox is selected, all other checkboxes are also
selected (hotmail style) (thanks for the groups help with this). The
onUnCick event doesn't work. Could anyone tell me how to correct it??

Thanks,

Ed

<html>
<head>
<title></title>
</head>
<body>

<form name=taskform action=test.php method=post>

<script language="JavaS cript">
<!--
var row_1 = new Array("Monday0" , "Monday1")
function check_boxes1(st ate)
{
for (y=0; y < row_1.length; y++)
{
for (i = 0; i < document.taskfo rm.elements.len gth; i++)
{
if (document.taskf orm.elements[i].name == row_1[y])
document.taskfo rm.elements[i].checked = state;
}
}
}
--> </script>

<table border=1 width=85%>
<tr>
<td class=small>Che ck increment</td>
<td class=small>tog gle</td>
<td class=small>0:0 0</td><td class=small>1:0 0</td>
</tr>
<tr>
<td class=small>on the hour</td>
<td><input type=checkbox name=checkall_r ow1
onClick="check_ boxes1(true)" onUnClick="chec k_boxes1(false) "></td>
<td><input type=checkbox name=Monday0></td>
<td><input type=checkbox name=Monday1></td>
</tr>
</table>
</form>
</body>
</html>

There is no "onUnClick" event!

You'll have to test (in your JavaScript) whether or not the checkbox is
checked.

If it's no longer checked then treat it as an "UnClick".
Jul 20 '05 #2
"McKirahan" <Ne**@McKirahan .com> wrote in message
news:qBgHb.4931 18$275.1390053@ attbi_s53...
"Edward" <eg****@hotmail .com> wrote in message
news:58******** *************** ***@posting.goo gle.com...
The code shown below displays a table in a form with 3 check boxes.
When the left checkbox is selected, all other checkboxes are also
selected (hotmail style) (thanks for the groups help with this). The
onUnCick event doesn't work. Could anyone tell me how to correct it??

Thanks,

Ed

<html>
<head>
<title></title>
</head>
<body>

<form name=taskform action=test.php method=post>

<script language="JavaS cript">
<!--
var row_1 = new Array("Monday0" , "Monday1")
function check_boxes1(st ate)
{
for (y=0; y < row_1.length; y++)
{
for (i = 0; i < document.taskfo rm.elements.len gth; i++)
{
if (document.taskf orm.elements[i].name == row_1[y])
document.taskfo rm.elements[i].checked = state;
}
}
}
--> </script>

<table border=1 width=85%>
<tr>
<td class=small>Che ck increment</td>
<td class=small>tog gle</td>
<td class=small>0:0 0</td><td class=small>1:0 0</td>
</tr>
<tr>
<td class=small>on the hour</td>
<td><input type=checkbox name=checkall_r ow1
onClick="check_ boxes1(true)" onUnClick="chec k_boxes1(false) "></td>
<td><input type=checkbox name=Monday0></td>
<td><input type=checkbox name=Monday1></td>
</tr>
</table>
</form>
</body>
</html>

There is no "onUnClick" event!

You'll have to test (in your JavaScript) whether or not the checkbox is
checked.

If it's no longer checked then treat it as an "UnClick".

This variation of your code does what you want; watch for word-wrap:
<html>
<head>
<title>unclicks .htm</title>
<script language="JavaS cript" type="text/lanaguage">
<!--
var row_1 = new Array("Monday0" , "Monday1")
function check_boxes1() {
var form = document.taskfo rm;
var state = false;
if (form.checkall_ row1.checked) state = true;
for (y=0; y < row_1.length; y++) {
for (i = 0; i < form.elements.l ength; i++) {
if (form.elements[i].name == row_1[y])
form.elements[i].checked = state;
}
}
}
-->
</script>
</head>
<body>
<form name="taskform" action="test.ph p" method="post">
<table border="1" width="85%">
<tr>
<td class="small">C heck increment</td>
<td class="small">t oggle</td>
<td class="small">0 :00</td>
<td class="small">1 :00</td>
</tr>
<tr>
<td class=small>on the hour</td>
<td><input type="checkbox" name="checkall_ row1"
onClick="check_ boxes1()"></td>
<td><input type="checkbox" name="Monday0"> </td>
<td><input type="checkbox" name="Monday1"> </td>
</tr>
</table>
</form>
</body>
</html>
Note that I:
a) relocated the <script> within the <head> tags;
b) inserted type="text/lanaguage";
c) declare "var form = document.taskfo rm;";
d) enclosed values (after "=") in quotes.

I have a habit of cleaning up other's code to my conventions...
Jul 20 '05 #3
"McKirahan" <Ne**@McKirahan .com> wrote in message
news:fMgHb.5422 0$VB2.95096@att bi_s51...
"McKirahan" <Ne**@McKirahan .com> wrote in message
news:qBgHb.4931 18$275.1390053@ attbi_s53...
"Edward" <eg****@hotmail .com> wrote in message
news:58******** *************** ***@posting.goo gle.com...
The code shown below displays a table in a form with 3 check boxes.
When the left checkbox is selected, all other checkboxes are also
selected (hotmail style) (thanks for the groups help with this). The
onUnCick event doesn't work. Could anyone tell me how to correct it??

Thanks,

Ed

<html>
<head>
<title></title>
</head>
<body>

<form name=taskform action=test.php method=post>

<script language="JavaS cript">
<!--
var row_1 = new Array("Monday0" , "Monday1")
function check_boxes1(st ate)
{
for (y=0; y < row_1.length; y++)
{
for (i = 0; i < document.taskfo rm.elements.len gth; i++)
{
if (document.taskf orm.elements[i].name == row_1[y])
document.taskfo rm.elements[i].checked = state;
}
}
}
--> </script>

<table border=1 width=85%>
<tr>
<td class=small>Che ck increment</td>
<td class=small>tog gle</td>
<td class=small>0:0 0</td><td class=small>1:0 0</td>
</tr>
<tr>
<td class=small>on the hour</td>
<td><input type=checkbox name=checkall_r ow1
onClick="check_ boxes1(true)" onUnClick="chec k_boxes1(false) "></td>
<td><input type=checkbox name=Monday0></td>
<td><input type=checkbox name=Monday1></td>
</tr>
</table>
</form>
</body>
</html>

There is no "onUnClick" event!

You'll have to test (in your JavaScript) whether or not the checkbox is
checked.

If it's no longer checked then treat it as an "UnClick".

This variation of your code does what you want; watch for word-wrap:
<html>
<head>
<title>unclicks .htm</title>
<script language="JavaS cript" type="text/lanaguage">
<!--
var row_1 = new Array("Monday0" , "Monday1")
function check_boxes1() {
var form = document.taskfo rm;
var state = false;
if (form.checkall_ row1.checked) state = true;
for (y=0; y < row_1.length; y++) {
for (i = 0; i < form.elements.l ength; i++) {
if (form.elements[i].name == row_1[y])
form.elements[i].checked = state;
}
}
}
-->
</script>
</head>
<body>
<form name="taskform" action="test.ph p" method="post">
<table border="1" width="85%">
<tr>
<td class="small">C heck increment</td>
<td class="small">t oggle</td>
<td class="small">0 :00</td>
<td class="small">1 :00</td>
</tr>
<tr>
<td class=small>on the hour</td>
<td><input type="checkbox" name="checkall_ row1"
onClick="check_ boxes1()"></td>
<td><input type="checkbox" name="Monday0"> </td>
<td><input type="checkbox" name="Monday1"> </td>
</tr>
</table>
</form>
</body>
</html>
Note that I:
a) relocated the <script> within the <head> tags;
b) inserted type="text/lanaguage";
c) declare "var form = document.taskfo rm;";
d) enclosed values (after "=") in quotes.

I have a habit of cleaning up other's code to my conventions...

Oops!

Change
type="text/lanaguage"
to
type="text/javascript"
Jul 20 '05 #4
In article <PTgHb.149595$8 y1.436960@attbi _s52>, "McKirahan"
<Ne**@McKirahan .com> writes:
I have a habit of cleaning up other's code to my conventions...

Oops!

Change
type="text/lanaguage"
to
type="text/javascript"


Now if we can just get you to snip the ~116 lines that you quoted :)

--
Randy
Jul 20 '05 #5
McKirahan wrote:
[monologues]


How am I supposed to post my replies in a newsgroup?:
http://www.allmyfaqs.com/faq.pl?How_to_post
PointedEars
Jul 20 '05 #6
JRS: In article <3F************ **@PointedEars. de>, seen in
news:comp.lang. javascript, Thomas 'PointedEars' Lahn
<Po*********@we b.de> posted at Sat, 27 Dec 2003 18:03:50 :-
How am I supposed to post my replies in a newsgroup?:


If you do not know, you should read the FAQ of this newsgroup.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3689
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function and passes it two parameters. For the life of me I cannot figure out what the error is, but one occurs everytime I click a &%*$&# radio button. Also, the function only alerts the user immediately as to what question/answer they clicked. I am...
17
61445
by: Mike Gratee | last post by:
Is it possible to use JavaScript to cause the browser to click a link on a page and have the browser act exactly like the user had clicked on the link directly? In other words, I need to programmatically issue a JavaScript statement which causes the browser to act just like the user clicked on a link in my page. And if that link has an onClick JS event defined, I'd want that onClick event to execute too, exactly the same as if the user...
2
9182
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display in the status bar 'Symantec Corporation' whenever anyone mouses over (onMouseOver) my image or link OR when one clicks while holding the left mouse down (onClick) on the same image or link. Upon releasing the mouse (onMouseOut), the
3
3271
by: Jamie Jackson | last post by:
I'm rewriting all links' onclick events, but I'm having a problem. The onclick event that I'm inserting works correctly in Opera, but not in FF or IE. I'm retroactively adding the statement "return promptBeforeOpening();" FF and IE rewrite it as I would expect them to, but it turns out that that doesn't work (no disclaimer pops up, and the link is not disabled):
2
18581
by: RobG | last post by:
I am trying to dynamically add an onclick to an element, however I just can't get the syntax right. consider the following function: function doClick (evt,x) { // do things with evt and x } Which is called statically by: <button onclick="doClick(event,this);">Click me</button>
2
3291
by: Sedef | last post by:
Hi, i'm trying to create a custom Button user control which will be derived from System.Web.UI.WebControls.Button. the normal server side Button class creates some client side javascript code for its onclick event. it's something like: <input type="submit" name="Button1" value="Button" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="Button1" /> what i want to do is to be able to...
6
7174
by: Nx | last post by:
i've got it all working nicely in firefox, but whenever i test it in IE none of the onclick events are triggered. i'm using an xsl to transform an rss feed into a photogallery. when i try to use setAttribute FF and safari work, but IE stops working when i used addEventListener and attachEvent safari stops working and when i tried .onClick,none of them worked being fairly inexperienced (but learning fast), i figure i'm doing it
7
2795
by: extremerep | last post by:
My task is to change the value of a button and then make it functional with the onClick handler. Changing the value to "Play Again" works, but making the onClick work accordingly does not. The following is a snippet of the script. What is keeping it from working? function displaycards1(){ document.form1.reveal1.value="Play Again"; document.form1.reveal1.onClick="setcards();"; } </script>
0
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.