How Do i use this Javascript

  • Thread starter Thread starter iHavAQuestion
  • Start date Start date
I

iHavAQuestion

How can I use this same javascript in the asp.net 2.0, where I have a master
page.


<html >
<script language="javascript" type="text/javascript">
function functionName(cnt_id)
{}
function functionName2
{}
</script>

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

Date: <input runat="server" id="TextBox1" type="text"
onfocus="javascript:functionName('TextBox1')"/>

</body>
</form>
</html>
 
My guess you have a problem with changed id of the control....

There are several solutions but in your case you can use "this"
<script language="javascript" type="text/javascript">
function functionName(cnt)
{
alert(cnt.id);
}
</script>

Date: <input runat="server" id="TextBox1" type="text"
onfocus="javascript:functionName(this);"/>

PS: also you can always use <%=TextBox1.ClinetID%>

PPS: Next try to point to a problem so we do not have to guess... :)

George.
 
I tried the same George before i posted the thread, but I ned to know, how do
I call the same javascript from the master page.
 
the master page is just a control on your page. you call javascript from it
just like any other control (there is no difference).

-- bruce (sqlwork.com)
 
Back
Top