472,328 Members | 1,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

onclick firing twice for CheckBox and RadioButton...


Can some one tell me why the onclick is firing twice for the radion button
and checkbox controls...?

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb"
Inherits="CustomerRelations.Testing" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Testing</title>
<!--
<script for="ckbCheckBox" event="onclick">
alert('ckbCheckBox click' +
document.getElementById("hdnActiveElementID").valu e);
//document.getElementById("hdnActiveElementID").valu e = this.id;
</script>
-->
<script language="jscript">

function doOnClickBody() {
//document.getElementById("hdnActiveElementID").valu e =
document.activeElement.id
alert(document.activeElement.offsetTop);
//alert('doOnClickBody click ' +
document.getElementById("hdnActiveElementID").valu e);
}

function doOnLoadBody() {
var selectedElementName =
document.getElementById("hdnActiveElementID").valu e;
//alert('doOnLoadBody load ' +
document.getElementById("hdnActiveElementID").valu e);
if (selectedElementName != ""){
document.getElementById(selectedElementName).focus ();
}
}
</script>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body onclick="doOnClickBody();" onload="doOnLoadBody();"
ms_positioning="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:CheckBox id="ckbCheckBox" style="Z-INDEX: 101; LEFT: 58px; POSITION:
absolute; TOP: 124px" runat="server" Text="Check Box"></asp:CheckBox>
<asp:RadioButton id="radRadio" style="Z-INDEX: 102; LEFT: 59px; POSITION:
absolute; TOP: 159px" runat="server" Text="Radio Button"></asp:RadioButton>
<asp:TextBox id="hdnActiveElementID" style="Z-INDEX: 103; LEFT: 48px;
POSITION: absolute; TOP: 281px" runat="server" Width="562px"></asp:TextBox>
<asp:TextBox id="hdnScrollTop" style="Z-INDEX: 104; LEFT: 48px; POSITION:
absolute; TOP: 309px" runat="server" Width="562px"></asp:TextBox>
<asp:DropDownList id="DropDownList1" runat="server" style="Z-INDEX: 105;
LEFT: 61px; POSITION: absolute; TOP: 83px" Width="201px"
AutoPostBack="True">
<asp:ListItem Value="book">book</asp:ListItem>
<asp:ListItem Value="paper">paper</asp:ListItem>
</asp:DropDownList>
</form>
</body>
</HTML>

Nov 17 '05 #1
2 3748
Hi,

Just want to inform you that I try your code and its run as expected
(one event).

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">"

basically is 1997 or 1998.
What is all the other crap about.

==========

It fires twice ?

--------

"Visual Basic 7.0"
Each time yo pay for it, right.


"alien2_51" <dan.billow"at"n.o.s.p.a.m.monacocoach.commercialv ersion> wrote
in message news:%2******************@TK2MSFTNGP10.phx.gbl...

Can some one tell me why the onclick is firing twice for the radion button
and checkbox controls...?

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb" Inherits="CustomerRelations.Testing" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Testing</title>
<!--
<script for="ckbCheckBox" event="onclick">
alert('ckbCheckBox click' +
document.getElementById("hdnActiveElementID").valu e);
//document.getElementById("hdnActiveElementID").valu e = this.id;
</script>
-->
<script language="jscript">

function doOnClickBody() {
//document.getElementById("hdnActiveElementID").valu e =
document.activeElement.id
alert(document.activeElement.offsetTop);
//alert('doOnClickBody click ' +
document.getElementById("hdnActiveElementID").valu e);
}

function doOnLoadBody() {
var selectedElementName =
document.getElementById("hdnActiveElementID").valu e;
//alert('doOnLoadBody load ' +
document.getElementById("hdnActiveElementID").valu e);
if (selectedElementName != ""){
document.getElementById(selectedElementName).focus ();
}
}
</script>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body onclick="doOnClickBody();" onload="doOnLoadBody();"
ms_positioning="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:CheckBox id="ckbCheckBox" style="Z-INDEX: 101; LEFT: 58px; POSITION: absolute; TOP: 124px" runat="server" Text="Check Box"></asp:CheckBox>
<asp:RadioButton id="radRadio" style="Z-INDEX: 102; LEFT: 59px; POSITION: absolute; TOP: 159px" runat="server" Text="Radio Button"></asp:RadioButton> <asp:TextBox id="hdnActiveElementID" style="Z-INDEX: 103; LEFT: 48px;
POSITION: absolute; TOP: 281px" runat="server" Width="562px"></asp:TextBox> <asp:TextBox id="hdnScrollTop" style="Z-INDEX: 104; LEFT: 48px; POSITION: absolute; TOP: 309px" runat="server" Width="562px"></asp:TextBox>
<asp:DropDownList id="DropDownList1" runat="server" style="Z-INDEX: 105; LEFT: 61px; POSITION: absolute; TOP: 83px" Width="201px"
AutoPostBack="True">
<asp:ListItem Value="book">book</asp:ListItem>
<asp:ListItem Value="paper">paper</asp:ListItem>
</asp:DropDownList>
</form>
</body>
</HTML>


Nov 17 '05 #3

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

Similar topics

3
by: Doug | last post by:
Hi, I wondering if anyone has noticed this and has a workaround. I've set up a delegate for the SelectedIndexChange event and noticed that it is...
1
by: rozrabiak | last post by:
Hi! I have problem witch Windows forms, CheckBox, RadioButton, ComboBox and database. How can I use checkbox (and other components) in...
7
by: Shane Bishop | last post by:
I've been fighting with the Page_Load event firing twice. I looked through this user group and saw several other people having similar problems....
4
by: Larry Morris | last post by:
The following code, pasted into a web form with a link button on it, will cause the page_unload event to fire twice. If I remove the...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might...
28
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is...
4
by: Brian P | last post by:
I have a service that is driven by a timer that fires every 5 seconds. For the most part, it works fine. But every once in a while the timer fires...
4
by: ShaneFowlkes | last post by:
I have a odd thing happening. I have a sub that is called upon a button click and it seems to be firing TWICE. I have no idea how this is...
2
by: ann | last post by:
I have a datagrid control I am using - the edit & update events are firing twice. I searched on google and see others have had same issue not just...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.