User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 374,571 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,576 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Apr 21st, 2007
Views: 6,578
A handy code that brings up a password window to keep others off of the web pages you choose.
Last edited : Apr 21st, 2007.
html Syntax | 4 stars
  1. <script language="JavaScript">
  2. var password;
  3. var pass1="PASSWORD-HERE";
  4. password=prompt('Whats The Magic Word?',' ');
  5. if (password==pass1) alert('That Is Correct!');
  6. else {
  7. window.location="SITE-LINK";
  8. }
  9. </script>
Comments (Newest First)
Mohan0704 | Newbie Poster | May 20th, 2008
sorry for the last post, my browser was laggy/not responding
Mohan0704 | Newbie Poster | May 20th, 2008
You can make a new .js/.jse file and make variables containing the password. Still, you can get into it. Try to make it as secure as you can. But it wouldn't be worth it for just 1 web page...
Mohan0704 | Newbie Poster | May 20th, 2008
You can make a new .js/.jse file and make variables containing the password. Still, you can get into it. Try to make it as secure as you can. But it wouldn't be worth it for just 1 web page...
Randy Epperson | Newbie Poster | Dec 2nd, 2007
I'm really new to Javascript so please pardon this naive question - if the value of the password is posted in line 3 and anyone can view the source of a page, how is the password protected?

Thanks
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 5:47 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC