473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How Do i use this Javascript

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>
Mar 24 '08 #1
3 1259
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.

"iHavAQuestion" <iH***********@discussions.microsoft.comwrote in message
news:66**********************************@microsof t.com...
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>

Mar 24 '08 #2
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.

"George Ter-Saakov" wrote:
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.

"iHavAQuestion" <iH***********@discussions.microsoft.comwrote in message
news:66**********************************@microsof t.com...
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>


Mar 24 '08 #3
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)
"iHavAQuestion" wrote:
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>
Mar 24 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.