Wednesday, June 13, 2012

Assignment Post 5 -Login Code

Today we learnt about codes. The first thing that we have to do in our assignment is to ask the viewer for the login of the website. When using sharepoint, there are different types of codes that do different things. Firstly You have to open up a blank page. Save it and call it Default.htm. Then you have to go the the useful links in the IST folder. There is a link called Login Code which takes you to a website that gives you the code for the Login. Here is the code below:

<script language="javascript">
<!--//
/*This Script allows people to enter by using a form that asks for a
UserID and Password*/
function pasuser(form) {
if (form.id.value=="JavaScript") {
if (form.pass.value=="Kit") {             
location="Home Page.htm"
} else {
alert("Invalid Password")
}
} else {  alert("Invalid UserID")
}
}
//-->
</script>
<center>
<table bgcolor="white" cellpadding="12" border="1">
<tr><td colspan="2"><center><h1><i><b>Login
Area</b></i></h1></center></td></tr>
<tr><td><h1><i><b>UserID:</b></i></h1></td><td><form name="login"><input
name="id" type="text"></td></tr>
<tr><td><h1><i><b>Password:</b></i></h1></td><td><input name="pass"
type="password"></td></tr>
<tr><td><center><input type="button" value="Login"
onClick="pasuser(this.form)"></center></td><td><center><br><input
type="Reset"></form></td></tr></table></center>


you will have to insert this code into the body section of the "code" page. After that, click save and previw on the internet. It should come up with a page looking like this:
Afterwards look in the code. It should state the username and password like in this one the username and password are JavaScript, Kit.


if (form.id.value=="JavaScript") {
if (form.pass.value=="Kit") {
  

You can also change this to which ever one you wish to have. After that there is on elast thing you need to change in the code and that is where the page leads you too. In this project after putting the username and password in, it should lead you to the homepage. therefore in the code, where it says:

 location="Home Page.htm"

You will have to change the location to your chosen page. Then when you put the username and password and log on, it will take you to the homepage. This was the first step for our website. Next lesson sir is going to teach us how to create an interactive menu. Excited!

No comments:

Post a Comment