Script Categories













Buttons Effects >>> Textarea.

Use JavaScript to alert your user with the contents of a textarea box! This serves little purpose in the real world, but nonetheless is a great example of JavaScript. Type something in the box and hit Alert Me!



Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
var Stop=false;
var max=0;
function textlist() {
max=textlist.arguments.length;
for (i=0; i<max; i++)
this[i]=textlist.arguments[i];
}
tl = new textlist(
"This is the newsticker. Great for giving visitors information. And lot's of it.",
"Infinite lines to write on, and an easy configuration - overall it's a breeze :-)",
"You can configure the messages and the size of the textarea, neat!",
"Rebuilt by Igor Ivanov, Russian programmer."
);

var x = 0; pos = 0;
var l = tl[0].length;
function textticker() {
document.tickform.tickfield.value = tl[x].substring(0, pos) + "_";
if(pos++ == l) {
pos = 0;
if(!Stop) setTimeout("textticker()", 2000);
if(++x == max) x = 0;
l = tl[x].length;
}
else
if(!Stop) setTimeout("textticker()", 50);

if (Stop) document.tickform.tickfield.value ='';
}
window.onload=textticker;
function Alert()
{
    alert(document.tickform.tickfield.value);
}
//  End -->
</script>
<center>
<form name=tickform>
<input
type="button" value="Alert Me!" onClick="Alert()"><br><br>
<textarea name=tickfield rows=3 cols=38 style="background-color: rgb(0,0,0); color: rgb(255,255,255); cursor: default; font-family: Arial; font-size: 12px" wrap=virtual onFocus="Stop=true">The news will appear here when the page has finished loading.</textarea>

</form>
</center>

Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©