Creating a Log-in Webpage The George Washington University Computer Science 1023 Professor Brenner (email@example.com)
Creating a Log-in Webpage
The George Washington University
Computer Science 1023
Professor Brenner (firstname.lastname@example.org)
- The user ID specified is not in a table of authorized users.
- The user ID is authorized, but the password is incorrect.
- Both the user ID and password are correct: a successful log-in.
Optional enhanced version for advanced programmers
The first thing that the second web page must do is retrieve the URL string pointing to itself. This is done by:
URLstring = window.location.href
and it will look something like this (recall the lab on Yahoo and Bookfinder.com):
Steps for Creating the Log-in Lab
- (Basic lab) Fetch the user-entered information from the text boxes by the usual:
userentry = formname.textboxname.value
2 (Advanced lab). Fetch the URL information into a string variable, as shown above for variable URLstring. Remember that the file name in the action= option of the <form> does not include the question mark or what comes after, as they are built by HTML when the Submit button is clicked. And of course, the second webpage cannot reference the first webpage’s textboxes by the above type of statement.
Use either .split or a combination of .indexOf and .substring to cut out the user-typed information (user ID and password) from the lengthy URLstring. (Review the Blackboard-posted file about strings for details.)
- Create either:
- One array in which dictionary lookup of the user ID returns with the password string. E.g.
dictusers=; dictusers[“username1”] = “password1”
Or B. Two arrays, one holding authorized user ID’s and the other, in parallel with it, the corresponding passwords. E.g.
users = [“username1”, “username2”]; pws = [“pw1”, “pw2”];
- Check that the user-typed ID is in the authorized list. If using method 4A, do a dictionary lookup. E.g. p = dictusers[whatwastypedinbox1]; the value of p will be equal to the variable (not the string!) undefined if what was typed is not in the dictionary, but will be the string of the corresponding password if it is in the dictionary. If using method 4B, write a for loop to iterate thru the ID array, using an if statement to compare the typed-in value to each item in the array.
- If the user ID is found in the authorized list, then immediately check the typed-in password against the password corresponding to the ID in the array. If using method 4B, use the index value at which the match of ID’s was made as a subscript in the password array.
- Display a suitable message for whichever of the three conditions is true.
99源码网,程序代做,代写程序代码,代写编程,代写Java编程,代写php编程,计算机专业代做,计算机毕业设计,网站建设,网站开发,程序 » Creating a Log-in Webpage The George Washington University Computer Science 1023 Professor Brenner (email@example.com)
- 本站所有资源版权均属于原作者所有，这里所提供资源均只能用于参考学习用，请勿直接商用。若由于商用引起版权纠纷，一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量，若小于网盘提示的容量则是这个原因。这是浏览器下载的bug，建议用百度网盘软件或迅雷下载。若排除这种情况，可在对应资源底部留言，或 联络我们.。
- 对于PPT，KEY，Mockups，APP，网页模版等类型的素材，文章内用于介绍的图片通常并不包含在对应可供下载素材包内。这些相关商业图片需另外购买，且本站不负责(也没有办法)找到出处。 同样地一些字体文件也是这种情况，但部分素材会在素材包内有一份字体下载链接清单。