Script 8: More complex user customization

What this script allows you to do is change the screen background color, so that who ever may want to visit your page can customize it a little.

Push any button here:

Here is an other variation of the script. Enter a color name (any color you want) in the box and click the "Color" button. DO NOT PUSH ENTER ON THE KEYBOARD!!

Here is the code for each variation:
The buttons:

<FORM>
<INPUT TYPE=button NAME=Button VALUE="Silver" onclick="document.bgColor='silver'">
<INPUT TYPE=button NAME=Button VALUE="Red" onclick="document.bgColor='red'">
<INPUT TYPE=button NAME=Button VALUE="Yellow" onclick="document.bgColor='yellow'">
<INPUT TYPE=button NAME=Button VALUE="Green" onclick="document.bgColor='green'">
<INPUT TYPE=button NAME=Button VALUE="Blue" onclick="document.bgColor='blue'">
<INPUT TYPE=button NAME=Button VALUE="White" onclick="document.bgColor='white'">
</FORM>

The text field:

<FORM>
<P><INPUT TYPE=text NAME=color VALUE="" SIZE=18>
<INPUT TYPE=button NAME=Button VALUE="Color" onclick="document.bgColor=(this.form.color.value)">
<INPUT TYPE=reset VALUE="Reset" name=cancel>
</FORM>

DOWNLOAD THE SCRIPT CODE IN .TXT format


Script 9

This script allows a scroling message in the middle of a web page:

Here is the Code for this somewhat complex script:

In the HEAD part of the HTML code:

<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript Applet -------------------
var scroll = "on"
function action ()
  {
    if (scroll == "on")
      scroll = "off"
   else
    {
      scroll = "on";
      banner(30);
      }
  }
function banner(input)
{
    if (scroll == "on")
      {
        var l1  = "Cool, don't you find?";     
        var l2  = "  This script is almost like a Java Applet, although it is not as complex.";
        var l3  = "   This is a perfect way to put a greeting mesage in a page!";
	    var l4  = "   ...Try it for yourself!    ";
        var msg=l1+l2+l3+l4;
        var space = " ";
         if (input <= 30 && input > 0) {
                for (var i=0 ; i < input ; i++) {
                        space+=" ";
} space+=msg; input--; var doit ="banner(" + input + ")"; document.sform.box.value=space; window.setTimeout(doit,100); } else if (input <= 0) { if (-input < msg.length) { space+=msg.substring(-input, msg.length); input--; var doit ="banner(" + input + ")"; document.sform.box.value=space; window.setTimeout(doit,100); } else { document.sform.box.value=" "; window.setTimeout("banner(30)",75); } } } else { document.sform.box.value = "No more scrolling until you say so...";
window.setTimeout("banner(30)",100); } } // -- End of JavaScript code ----------------> </SCRIPT><P>
And in the BODY part where ever you want:

<body onload="banner(30)">
<center>
<form name="sform"><input type="text" name="box" size="70">
</form>

DOWNLOAD THE SCRIPT CODE IN .TXT format


Script 10

This Script is just a simple calculator that adds, substracts, multiplies and divides
two or more numbers.
Enter a Math expression (like 9+5) followed by the "Calculate" button:

Result:

The standard operators that this script uses is "+", "-", "*"(multiply) and "/"(divide).
Here is the HTML scripting code:

In the <HEAD> part:

<SCRIPT LANGUAGE="JavaScript">
function compute(form) {
			if (confirm("Are you sure? (You don't really need this confirmation, 
but I like it, for it uses JavaScript. -Anatole")) form.result.value = eval(form.expr.value) else alert("Too bad. This could of been cool...") } </SCRIPT>

In the <BODY> part:

<FORM>
Enter a Math expression (like 9+5) followed by the "Calculate" button:<BR>
<INPUT TYPE="text" NAME="expr" SIZE=15 >
<INPUT TYPE="Button" VALUE="Calculate" onClick="compute(this.form)">
<BR>
Result:<BR>
<INPUT TYPE="text" NAME="result" SIZE=15 >
<BR>
</FORM>

DOWNLOAD THE SCRIPT CODE IN .TXT format


Click HERE to return to the JavaScript page
Click HERE to return to the AnatoleNET Home Page
This page is hosted by GEOCITIES