473,408 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Creating a JavaScript login page

I'm writting a login script using JavaScript, can someone help with the parts I've commented? Thank you


Expand|Select|Wrap|Line Numbers
  1. <HTML><HEAD>
  2. <TITLE>Login Program</TITLE>
  3. </HEAD>
  4.  
  5. <SCRIPT>
  6.  
Expand|Select|Wrap|Line Numbers
  1. function validate() {
  2.     y=document.getElementById('username');
  3.     x=document.getElementByID('password');
  4.  
  5. // if y.value=='england' && x.value=='england' {
  6. //*** go to menuPage.htm   
  7. //  }    
  8. //  else {
  9.       //*** go back to loginTest.htm
  10. //  }
  11. }
  12.  
Expand|Select|Wrap|Line Numbers
  1. </SCRIPT>
  2.  
  3. <BODY>
  4.  
  5. Your Name:
  6. <input type="text" name id="username" size="25" maxlength="25">
  7. <br></br>
  8.  
  9. Your Password:
  10. <input type="text" name id="password" size="25" maxlength="25"/>
  11. <br></br>
  12.  
  13. </SELECT>
  14.  
  15. <br></br>
  16.  
  17. <span><a href="validate()">Login</a></span>
  18.  
  19. </BODY>
  20. </HTML>
Sep 27 '07 #1
3 2700
pbmods
5,821 Expert 4TB
Heya, Divina.

Changed thread title to better describe the problem.

You'll want to set window.location.href.
Sep 28 '07 #2
Thank you pbmods,
Expand|Select|Wrap|Line Numbers
  1. window.location.href 
did the trick, also managed to add a validation script which also works fine.

The only problem is that people can view the source code and retrieve my username and password, but I guess thats why I shouldn't use javascript for loging in.

Thanks again as always.

D
Sep 28 '07 #3
acoder
16,027 Expert Mod 8TB
The only problem is that people can view the source code and retrieve my username and password, but I guess thats why I shouldn't use javascript for loging in.
If you've got support for a server-side language, then use that instead.
Sep 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: clemenr | last post by:
Hi. I would like to know if the following is feasible in JavaScript. I would create a frameset where the top frame includes JavaScript. The bottom frame would be directed to the login page of an...
7
by: joey.powell | last post by:
I have a home page with username and password textboxes and a login button for purposes of users being able to log in (forms authentication) directly on the site home page. I also have a dedicated...
5
by: mouac01 | last post by:
I'm new to PHP/Javascript. I have a simple form I want to validate the fields with javascript and then run the PHP script. All the scripts are in one page. I want PHP to control where the next...
4
by: Quitchat | last post by:
Hi all, I'm kind of a javascript newbie here. I'm just wondering if there is a way to create a toplevel masking DIV? For example,I have a page that displays a Login hyperlink as well as some...
1
by: jianxin9 | last post by:
Hi, I have an ajax powered tabs box that has a javascript drop-down search menu in the first tab. When I click on another tab, and go back to the first tab I have to refresh the page to get the...
2
nirmalsingh
by: nirmalsingh | last post by:
hai all, i am having 2 pages. login.html and city.html login.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...
14
victorduwon
by: victorduwon | last post by:
Hi guys and gals, I am using javascript to autologin to my google analytics account via a hyperlink. This is what the text looks like this <?xml version="1.0" encoding="utf-8"?>...
3
by: krg | last post by:
Hi, I started writing this blog some time back and it would be great if I could get an audience here and even better if we could have a conversation about developments possible on the techniques I...
2
by: tvnaidu | last post by:
I have Two kinds of web pagess, one is for control page for only admin login, another one is to view status for user login. initially both html files can view with 192.168.0.10/control.htm and other...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.