473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 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 3839
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 firing twice - does nayone else have...
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 database? I want to check the checkbox in My form and...
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. There were various reasons for it:...
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 response.redirect, the problem goes away :). I've got a work...
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 interest quite a few people. One of my colleaques...
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 supposed to figure out which handlers to invoke when...
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 twice. In the log I can see that when it 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 happening but I suspect is has something to do with...
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 with datagrid but with other controls, but no...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.