LostFocus ASP.Net

Paramba Messages postés 47 Date d'inscription vendredi 18 novembre 2005 Statut Membre Dernière intervention 3 septembre 2012 - 18 nov. 2005 à 14:30
Paramba Messages postés 47 Date d'inscription vendredi 18 novembre 2005 Statut Membre Dernière intervention 3 septembre 2012 - 18 nov. 2005 à 14:37
Salut,
Je n arrive pas à générer l 'événement lostfocus sur une zone de texte ds une webform. Je voudrais qu un objet ( boutons radio) s affiche/s affiche pas une fois l'événement survenu.
Voici le code:

<%@ Page Language="VB" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


<script runat="server">


Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)


TextBox5.Attributes.Add("onBlur", "JavaScript:return(Affiche('hidden'));")


End Sub


</script>


<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">


<title>Test</title>


</head>


<body>


<form id="form1" runat="server">


<div>


<asp:TextBox ID="TextBox5" Style="z-index: 104; left: 72px; position: relative; top: 24px" Runat="server"></asp:TextBox>


<br />


Date of Birth<br />


</div>


<asp:RadioButtonList ID="RadioButtonList1" runat="server" Height="56px" Style="z-index: 106;


left: 432px; position: absolute; top: 184px" BorderStyle="Inset">


<asp:ListItem Text= "Pregnant" Value="Truc1"/>


<asp:ListItem Text= "Not Pregnant" Value="Truc2"/>


<asp:ListItem Text= "Dont know" Value="Truc3" Selected="True"/>


</asp:RadioButtonList>


<script language="JavaScript" type="text/javascript">


function Affiche()


{


var elem1 = document.forms[0].elements["RadioButtonList1"];


elem1.style="visibility:hidden;";


return(true);


}


</script>


</form>


</body>


</html>


Merci d avance!!

1 réponse

Paramba Messages postés 47 Date d'inscription vendredi 18 novembre 2005 Statut Membre Dernière intervention 3 septembre 2012
18 nov. 2005 à 14:37
Pardon!

TextBox5.Attributes.Add("onBlur", "JavaScript:return(Affiche('hidden'));") à remplacer par:


TextBox5.Attributes.Add("onBlur", "JavaScript:return(Affiche());")
0
Rejoignez-nous