Sometimes your web pages maybe need to keep some information secret. You must want to set a password for the web page and people who know the password can view information in your web page. When you open a new web page, there will be a dialog box, asking the viewers put the right passwords. If the pass words are right, the viewers will go to your web page. If the passwords are wrong, the viewers will see the dialog box again and it asks the viewers to input password again.
You can come across this case when you view some people’s blog, or login some university’s database. Now let us learn how to add the password for our web page. Follow me step by step.
|
First, open the finished web page. Or build a new blank web page.
Second, click the code button, and open the code view. Put the following blue text codes in to the section between <head> and </head>.
- <script language="JavaScript"><!--
- var pd=""
- var rpd="123"
- pd=prompt("please put your password:","")
- if(pd!=rpd){
- alert("your password is wrong")
- history.back()
- }else{
- alert("your password is right!")
- window.href="index.htm"
- }
- // --></script>
In the HTML codes, we definite a variable, and set the right password to it. then we define another variable, and set the viewer’s password to it. if the second variable is same with the first variable, the window will open the index.htm. if the second variable isn’t same with another, the window will rule out the “history.back” command, going back to the history.
Third, go back to the design view. Save the document and preview the web page in the Internet Explorer. There will be a message box appearing at once, asking you to put the password.
Ok, the web page with the password is ready. Have you master the way to set the password for the webpage? Practice regularly until you are familiar with the codes.


[...] from: Dreamweaver 8.0 Tutorial —- How To Set Password For The Web Page … By admin | category: Uncategorized | tags: best, design-but, develop-sites, keep-some, [...]
hai i am vivek,
i dnt knw abt dreamweaver. but urgently i need a dreamweaver program of design a home page for a book store.
i need procedures please help me. how to create a pgm
my mail id: vivek_rid@yahoo.in
please sent pgms to this id. please……………..