Add select option code for anti-51job in js

Source: Internet
Author: User

This JavaScript supports multiple users, multiple passwords, and multiple target webpages. Its proposal is a very easy-to-use interface, making it easy to add and delete users.

<Script language = "JavaScript">
<! -- Begin
Var params = new Array (4 );
Var script = document. js. scrpt. value;
Document. js. scrpt. value = "Create your users, their passwords, and their destination pages using the form above. nnThen, click 'show coding' to see the login HTML and JavaScript that you need to put on your page to password-protect your site with that info. nnQuestions about this script or how to put it on your site shocould be directed to it's author via email: dion@mailhub.omen.com.aunn * Honestly, we do N'T even totally understand this JavaScript! *";
Var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI ";
Showmem (document. members );
Function showmem (form ){
Document. members. num. value = document. members. memlist. length;
Var which = form. memlist. selectedIndex;
Splt (form. memlist [which]. value );
Form. entry. value = which + 1;
For (I = 2; I <5; I ++ ){
Form. elements [I]. value = params [i-2];};
}
Function splt (choice ){
P = 0;
For (I = 0; I <3; I ++ ){
A = choice. indexOf ("|", p );
Params [I] = choice. substring (a, p );
P = a + 1;
   }
}
Function addnew (form ){
Newmem = getfields (form );
Var who = prompt ("New User's Name :","");
Form. memlist [form. memlist. length] = new Option (who, newmem, false, true );
If (navigator. appName = "Netscape "){
Document. js. scrpt. value = script;
History. go (0 );
}
Else {
Showmem (document. members );
   }
}
Function getfields (form ){
Newmem = "";
For (I = 2; I <5; I ++ ){
Newmem + = form. elements [I]. value + "| ";};
For (I = 3; I <5; I ++ ){
A = form. elements [I];
For (k = 0; k <8; k ++ ){
   }
}
Return (newmem );
}
Function delthis (form ){
If (confirm ("Delete" + form. memname. value + "? ")){
Form. memlist. options [form. entry. value-1] = null;
Form. message. value = form. memname. value + "Deleted ";
Form. memlist. selectedIndex = 0;
If (navigator. appName = "Netscape "){
Document. js. scrpt. value = script;
History. go (0 );
}
Else {
Showmem (document. members );
      }
   }
}
Function update (form ){
Msg = "no ";
A = form. elements [I];
For (k = 0; k <8; k ++ ){
B = a. value. substring (k, k + 1 );
C = B. toUpperCase ();
Form. memlist [form. entry. value-1]. value = getfields (form );
Form. message. value = form. memname. value + "'s record was updated ";
   }
}
Function create (form ){

Var html = "<center> <form name = login> n ";
Html + = "<table border = 1 cellpadding = 3> nn ";
Html + = "<! -- Original: Dion --> n ";
Html + = "<! -- Web Site: http://members.xoom.com/yoboseyo --> n ";
Html + = "<! -- This script and more are available free online at --> n ";
Html + = "<! -- The JavaScript Source !! Javascript.internet.com "> http://javascript.internet.com --> nn ";
Html + = '<tr> <td colspan = 2 align = center> <font size = "+ 2"> ';
Html + = '<B> Members-Only Area! </B> </font> </td> </tr> N ';
Html + = "<tr> <td> Username: </td> <select name = memlist> n <option value = 'X'> ";
For (j = 0; j <form. memlist. length; j ++ ){
Splt (form. memlist. options [j]. value );
H1 = makehash (params [1], 3 );
H2 = makehash (params [1], 10) + "";
Var page = "";
For (var I = 0; I <8; I ++ ){
Letter = params [2]. substring (I, I + 1 );
Ul = letter. toUpperCase ();
A = alpha. indexOf (ul, 0 );
A + = (h2.substring (I, I + 1) * 1 );
Page + = alpha. substring (a, a + 1 );
}
Html + = "n <option value = '" + params [0] + "|" + h1 + "|" + page + "'>" + params [0];
};
Html + = "n </select> </td> </tr> n ";
Html + = "<tr> <td> Password: </td> <input type = password size = 10 maxlength = 8 name = pass> </td> </tr> n ";
Html + = '<tr> <td colspan = 2 align = center> <input type = button value = "Login" onclick = "check (this. form) "> </td> N ';
Html + = "</tr> n </table> n </form> n ";
Document. js. scrpt. value = html + script + "</center> ";
}
Function makehash (pw, mult ){
Pass = pw. toUpperCase ();
Hash = 0;
For (I = 0; I <8; I ++ ){
Letter = pass. substring (I, I + 1 );
C = alpha. indexOf (letter, 0) + 1;
Hash = hash * mult + c;
}
Return (hash );
}
// End -->
</Script>

<Table border = 1 width = "400">
<Tr> <form name = members> <td rowspan = 4>
<Select name = memlist size = 10 onChange = "showmem (this. form)">
<Option selected value = "John Smith | password | mainpage |"> John Smith
<Option value = "Peter Jones | theirpwd | endpages |"> Peter Jones
<Option value = "Sue Brown | asdfvcxz | nowheres |"> Sue Brown
<Option value = "Sally West | zaqxswde | logintop |"> Sally West
</Select> </td>
<Td align = right> User: </td> <input type = hidden value = "0" name = entry>
<Input type = text name = memname size = 8 value = ""> </td> </tr>
<Tr> <td align = right> Password: </td> <input type = text name = password size = 8 maxlength = 8> <font size = "-1"> <-- Must be exactly 8 characters </ font> </td> </tr>
<Tr> <td align = right> Page Name: </td> <input type = text name = pagename size = 8 maxlength = 8> <B>. html </B> <font size = "-1"> <-- Must be exactly 8 characters </font> </td> </tr>
<Tr> <td colspan = 2 align = center>
<Input type = button value = "New User" onclick = "addnew (this. form);">
<Input type = button value = "Delete User" onclick = "delthis (this. form);">
<Input type = button value = "Update/Show Coding" onclick = "update (this. form); create (this. form);"> </td> </tr>

<Tr> <td colspan = 3 align = center>
<Input type = text size = 60 name = message value = "Note: Password/Page Name must be exactly 8 letters! (A-z) ">
<Input type = hidden name = num value = 1> </td>
</Form> </tr>
</Table>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.