onclick firing twice for CheckBox and RadioButton...

  • Thread starter Thread starter alien2_51
  • Start date Start date
A

alien2_51

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").value);
//document.getElementById("hdnActiveElementID").value = this.id;
</script>
-->
<script language="jscript">

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

function doOnLoadBody() {
var selectedElementName =
document.getElementById("hdnActiveElementID").value;
//alert('doOnLoadBody load ' +
document.getElementById("hdnActiveElementID").value);
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>
 
"<!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 said:
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").value);
//document.getElementById("hdnActiveElementID").value = this.id;
</script>
-->
<script language="jscript">

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

function doOnLoadBody() {
var selectedElementName =
document.getElementById("hdnActiveElementID").value;
//alert('doOnLoadBody load ' +
document.getElementById("hdnActiveElementID").value);
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
 
Back
Top