Results 1 to 5 of 5
  1. #1
    Junior Member
    elliottedgar87 is offline

    Posts
    0

    My JavaScript Scripts

    Below we have some cool Javascript scripts to add interactivity and movment to your website/blog.

    Similar Threads:



  2. #2
    Junior Member
    elliottedgar87 is offline

    Posts
    0
    Here is one that makes your background flash random colours. You can asign the starting colour at the top also.
    Code:
    <!--Put this in your head section-->
    <script language="JavaScript">
    <!--
    
    r=135;
    g=235;
    b=005;
    flag=0;
    t=new Array;
    
    o=new Array;
    
    d=new Array;
    
    function hex(a,c)
    {
    t[a]=Math.floor(c/16)
    o[a]=c%16
    switch (t[a])
    {
    case 10:
    t[a]='A';
    break;
    case 11:
    t[a]='B';
    break;
    case 12:
    t[a]='C';
    break;
    case 13:
    t[a]='D';
    break;
    case 14:
    t[a]='E';
    break;
    case 15:
    t[a]='F';
    break;
    default:
    break;
    }
    switch (o[a])
    {
    case 10:
    o[a]='A';
    break;
    case 11:
    o[a]='B';
    break;
    case 12:
    o[a]='C';
    break;
    case 13:
    o[a]='D';
    break;
    case 14:
    o[a]='E';
    break;
    case 15:
    o[a]='F';
    break;
    default:
    break;
    }
    }
    
    function ran(a,c)
    {
    if ((Math.random()>2/3||c==0)&&c<255)
    {
    c++
    d[a]=2;
    }
    else
    {
    if ((Math.random()<=1/2||c==255)&&c>0)
    {
    c--
    d[a]=1;
    }
    else d[a]=0;
    }
    return c
    }
    function flash()
    {
    if (flag==0)
    {
    r=ran(1, r);
    g=ran(2, g);
    b=ran(3, b);
    hex(1,r)
    hex(2,g)
    hex(3,b)
    document.body.style.background="#"+t[1]+o[1]+t[2]+o[2]+t[3]+o[3]
    flag=50
    }
    else
    {
    r=do_it(1, r)
    g=do_it(2,g)
    b=do_it(3,b)
    hex(1,r)
    hex(2,g)
    hex(3,b)
    document.body.style.background="#"+t[1]+o[1]+t[2]+o[2]+t[3]+o[3]
    flag--
    }
    
    setTimeout('flash()',100)
    }
    //-->
    </script>
    <!--Put the rest INSIDE the body tag-->
    
    <body onload="flash()">



  3. #3
    Junior Member
    elliottedgar87 is offline

    Posts
    0
    Here is one that make a low security password script that uses a javascript prompt box. It is vunerable though to people looking over shoulders as the letters/numbers are not replaced with black circles.
    Code:
    
    <!--This goes in your body section. You can change the password below  about 8 code lines below. It is currently password1. You will also need to change the page where you want it to go, just change protectpage.html to your page you want.-->
    
    <SCRIPT>
     function login() {
     var testV = 1;
     var pass1 = prompt('Enter Password',' ');
     while (testV < 3) {
     if (!pass1) 
    history.go(-1);
     if (pass1() == "password1") {
     window.open('protectpage.html');
     break;
     } 
    testV+=1;
     var pass1 = 
    prompt('Password Incorrect, Try again.','Password');
     }
     if (pass1()!="password" & testV ==3) 
    history.go(-1);
     return "";
     } 
    </SCRIPT>
     
     <!--The actual form bit goes where you want the login button  to apear. You could enhance this script by copying the whole thing and making it a username, then past the password one into the correct bit of the login function. -->
    
     <FORM>
     <input type="button" value="Login" onClick="login()">
     </FORM>



  4. #4
    Junior Member
    noahhayesgamer is offline

    Posts
    0
    Cool but you can just refrees to try again!


  5. #5
    Junior Member
    elliottedgar87 is offline

    Posts
    0
    do you mean refresh?


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright © 2009-2012 BuyPoe.com All Rights Reserved.

Design Sites:
vBulletin Mods
Facebook Covers
| Free Facebook Covers
Google Covers | Google Plus Covers

Game Sites:
MMORPG
| MW3