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
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.
Re: Help with javascript in asp.net
can yo give me an example.
/tyson
Re: Help with javascript in asp.net
<input type="text" onChange="javascript:DET_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.
Re: Help with javascript in asp.net
how can i call it from codebehind to
/TYson
Re: Help with javascript in asp.net
VB Code:
Me.TextBox1.Attributes.Add("onChange","DET_DATE('" & Now.ToShortDateTimeString & "','" & strUsername & "');")
Re: Help with javascript in asp.net
Quote:
Originally Posted by mendhak
VB Code:
Me.TextBox1.Attributes.Add("onChange","DET_DATE('" & Now.ToShortDateTimeString & "','" & strUsername & "');")
thx!
/tyson