|
-
Oct 25th, 2005, 05:11 AM
#1
Thread Starter
Member
Help with javascript in asp.net
Hi!
i have the following javascript. I used it on a asp site before
Code:
<SCRIPT LANGUAGE="javascript" type="text/javascript">
// Funktionen sätter in signatur i meddelandet
function DET_DATE () {
var date = "<%= now%>";
var USer ="<%= Username %>";
var intext = document.getElementById("content").value;
document.getElementById("content").value = intext + "\r\n" + "\r\n" + date + " : " + USer + "\r\n"
}
</script>
how can i get it to execute when i change text in a textbox and what changes do i have to do to replace now and username with .net syntax
/tyson
-
Oct 25th, 2005, 08:44 AM
#2
Re: Help with javascript in asp.net
Call DET_DATE in the onChange event of your textbox. When calling it, pass the username and date value as arguments to your function.
-
Oct 25th, 2005, 09:52 AM
#3
Thread Starter
Member
Re: Help with javascript in asp.net
can yo give me an example.
/tyson
-
Oct 25th, 2005, 10:22 AM
#4
Re: Help with javascript in asp.net
<input type="text" onChange="javascript ET_DATE(now,username);">
In your js function:
PHP Code:
// Funktionen sätter in signatur i meddelandet
function DET_DATE (thedate, theusername) {
var date = thedate
var USer = theusername;
var intext = document.getElementById("content").value;
document.getElementById("content").value = intext + "\r\n" + "\r\n" + date + " : " + USer + "\r\n"
}
Note, I have no idea what or where username comes from.
-
Oct 25th, 2005, 10:42 AM
#5
Thread Starter
Member
Re: Help with javascript in asp.net
how can i call it from codebehind to
/TYson
-
Oct 25th, 2005, 12:42 PM
#6
Re: Help with javascript in asp.net
VB Code:
Me.TextBox1.Attributes.Add("onChange","DET_DATE('" & Now.ToShortDateTimeString & "','" & strUsername & "');")
-
Oct 25th, 2005, 04:17 PM
#7
Thread Starter
Member
Re: Help with javascript in asp.net
 Originally Posted by mendhak
VB Code:
Me.TextBox1.Attributes.Add("onChange","DET_DATE('" & Now.ToShortDateTimeString & "','" & strUsername & "');")
thx!
/tyson
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|