HTML

 

Spring 2009

 

Creating a login script using JavaScript with username and password - Nicholas

Add this line of code as the last line in your header section of your web page:

<script type="text/javascript" src="scripts/XXXXXXXXX.js"></script>

 

Once that is done make a JavaScript with the following code to run the login:

// Login Function

function Login(form) {
var done=0;
var username = form.username.value
username = username.toLowerCase();
var password = form.password.value;
password = password.toLowerCase();
if (username=="XXXXXXX" && password=="XXXXXXX") { window.location="homepage.html";
done=1; }
if (username=="XXXXXXX" && password=="XXXXXXX") { window.location="homepage.html";
done=1; }
if (done==0) { alert("Invalid login!"); }
}

 

To set a page anchor with a links at the top of the page - Nicholas

 

Used to skip to different location on the page use the following code to show a list of A-Z with page anchors.

 

<tr>
<td>
<p align="left"><br />
<font face="Verdana"><a href="#A">A</a> <a href="#B">B</a>
<a href="#C">C</a> <a href="#D">D</a> <a href="#E">E</a>
<a href="#F">F</a> <a href="#G">G</a> <a href="#H">H</a>
<a href="#J">J</a> <a href="#K">K</a> <a href="#L">L</a>
<a href="#M">M</a> <a href="#N">N</a> <a href="#O">O</a>
<a href="#P">P</a> <a href="#R">R</a> <a href="#S">S</a>
<a href="#T">T</a> <a href="#W">W</a> <a href="#Z">Z</a></font></p>
</td>
</tr>

 

<p><font face="Verdana" class="style15"><a NAME="A"></a>
<strong>A </strong></font></p>
<li><font face="Verdana">
<a href="XXXXXXXXXXXXXXXXXXXXX">XXXXXXXXXXXXXXX</a></font></li>

 

<p><font face="Verdana" class="style15"><a NAME="B"></a>
<strong>B </strong></font></p>
<li><font face="Verdana">
<a href="XXXXXXXXXXXXXXXXXXXXX">XXXXXXXXXXXXXXX</a></font></li>

etc.......