How Do i use this Javascript

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>
 
G

George Ter-Saakov

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

iHavAQuestion

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.
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top