BBS水木清华站∶精华区

发信人: midi (迷笛), 信区: WWW 
标  题: 【JavaScript Applet】在Homepage中滚动显式 
日  期: Wed Feb 28 13:45:28 1996 
 
 
<HTML> 
<head> 
<SCRIPT LANGUAGE="JavaScript"> 
 
 
 
<!-- Beginning of JavaScript Applet ------------------- 
 
   /* Copyright (C)1996 SDAS, Inc. DBA GeneralNET 
   All Rights Reserved. 
 
  This applet can be used or modified, if credit is given to 
   GeneralNET in  the source code and the Web page where  
   this application will appear. Thank you for not taking advantage 
   of our kindness by adhereing to our simple copy right requiremenst. 
    
 
   We will not be held responsible for any unwanted effects due to the  
   usage of this applet or any derivative.  No warrantees for usability  
   for any specific application are given or implied. 
*/ 
 
var scroll = "on" 
 
function action () 
  { 
    if (scroll == "on") 
      scroll = "off" 
   else 
    { 
      scroll = "on"; 
      banner(30); 
      } 
  } 
 
function banner(input) 

    if (scroll == "on") 
      { 
        var msg="This is a demo. You are welcome!!!!!!!!!"; 
        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> 
 
</head> 
<body onload="banner(30)"> 
<center> 
 
<form name="sform"> 
<input type="button" value="ON/OFF " onclick="action()"><input type="text"  
name="box" size="60"> 
</form> 

BBS水木清华站∶精华区