0

i want to say this rule by javascript in asp.net page:
for any controls in page if control.text=" " then set control.text="" (for page textbox controls only)
how can i implement this in javascript language in asp.net form?

2
Contributors
3
Replies
6
Views
7 Years
Discussion Span
Last Post by __avd
0

>how can i implement this in javascript language in asp.net form?

In asp.net web form add <script> tag,

....
  <head runat="server">
       <script type="text/javascript">
            // put javascript code here...
       </script>
  </head>
 ....
0

thnx but i know how to write javascript language!!!
i dont know how write this rule in javascript:
(for any controls in page if control.text="&nbsp;" then set control.text="" (for page textbox controls only))

Edited by MarziehA: n/a

0

Take a look,

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Sample</title>
    <script type="text/javascript">
      function doClear(){
        var input=document.getElementsByTagName("input");
        for(i=0;i<input.length;i++){
           if(input[i].type=="text")
             input[i].value="";
        } 
      }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:TextBox ID="TextBox2"
            runat="server"></asp:TextBox>
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        <button type="button" onclick="doClear()">Clear</button>
    </div>
    </form>
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.