PC Review


Reply
Thread Tools Rate Thread

Add a password to a button's OnMouseDown

 
 
JNariss@gmail.com
Guest
Posts: n/a
 
      30th Jan 2006
Hello,

I have created an Intranet for my company and was trying to figure out
if I can add a password to a button on my webpage. Well........I know I
can the question now is how???

I want to add the password to this code (the code for my button):

<p>
<a href="Overnight%20Parking.doc">
<img border="0" id="img20" src="../Buttons/button353.jpg" height="33"
width="165" alt="Overnight Parking"
onmouseover="FP_swapImg(1,0,/*id*/'img20',/*url*/'../Buttons/button354.jpg')"
onmouseout="FP_swapImg(0,0,/*id*/'img20',/*url*/'../Buttons/button353.jpg')"
onmousedown="FP_swapImg(1,0,/*id*/'img20',/*url*/'../Buttons/button355.jpg')"
onmouseup="FP_swapImg(0,0,/*id*/'img20',/*url*/'../Buttons/button354.jpg')"
fp-style="fp-btn: Glass Rectangle 3" fp-title="Overnight
Parking"></a></p></div>
<p>


I figure it will have to be somehow implemented into the onmousedown,
however I am unsure of how to do this.

I have a simple password code that works when added to the beginning of
my html code for when a page is opened, which is:

<SCRIPT language="JavaScript">
<!--hide

var password;

var pass1="cool";

password=prompt('Please enter your password to view this page!',' ');

if (password==pass1)
alert('Password Correct! Click OK to enter!');
else
{
window.location="http://www.pageresource.com/jscript/jpass.htm";
}

//-->
</SCRIPT>


I also found this code within the search groups:

<!-- Begin


function click() {
if (event.button==2) {
alert('Sorry, on the login page you cannot right-click. This is for
security reasons.');


}
}


document.onmousedown=click

function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="user1" && password=="pass1") {
window.location="logged.htm"; done=1; }
if (username=="user2" && password=="pass2") {
window.location="logged.html"; done=1; }
if (username=="user3" && password=="pass3") {
window.location="logged.html"; done=1; }
if (username=="user4" && password=="pass4") {
window.location="logged.html"; done=1; }
if (done==0) { alert(" Login failure. Try again. "); }


//The following are the greetings for each user


if (username=="user1" && password=="pass1") { alert(" Hello User1!
"); }
if (username=="user2" && password=="pass2") { alert(" Hello user2!
"); }
if (username=="user3" && password=="pass3") { alert(" Hello user3!
"); }
if (username=="user4" && password=="pass4") { alert(" Hello user4!
"); }



}


// End -->



But I have no idea where to enter the code into the current html code.
If anyone could help me with this I would greatly appreciate it. Unless
someone has a better idea that will work too.

Thanks,
Justine

 
Reply With Quote
 
 
 
 
Ronx
Guest
Posts: n/a
 
      30th Jan 2006
Secure password protection requires server side scripting or the use
of subwebs (if your host supports subwebs with unique permissions.
See
Password Protect Part of a Web:
http://support.microsoft.com/default...b;en-us;301554

Protect individual pages:
http://support.microsoft.com/default...b;en-us;825498


If you must use JavaScript for security, the script you have is
useless - the password is in the script for all to see with View
Source - and try it with JavaScript turned off. A better method of
using JavaScript is at www.rxs-enterprises.org/tests/jspass/, which
fails gracefully with no JavaScript, but is still not secure.

In the fist two methods, the Interactive Button should be simply
linked to the secured page - the login dialogue will appear
automatically. In the third case, the button links to Login page.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
FrontPage Support: http://www.frontpagemvps.com/

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I have created an Intranet for my company and was trying to figure
> out
> if I can add a password to a button on my webpage. Well........I
> know I
> can the question now is how???
>
> I want to add the password to this code (the code for my button):
>
> <p>
> <a href="Overnight%20Parking.doc">
> <img border="0" id="img20" src="../Buttons/button353.jpg"
> height="33"
> width="165" alt="Overnight Parking"
> onmouseover="FP_swapImg(1,0,/*id*/'img20',/*url*/'../Buttons/button354.jpg')"
> onmouseout="FP_swapImg(0,0,/*id*/'img20',/*url*/'../Buttons/button353.jpg')"
> onmousedown="FP_swapImg(1,0,/*id*/'img20',/*url*/'../Buttons/button355.jpg')"
> onmouseup="FP_swapImg(0,0,/*id*/'img20',/*url*/'../Buttons/button354.jpg')"
> fp-style="fp-btn: Glass Rectangle 3" fp-title="Overnight
> Parking"></a></p></div>
> <p>
>
>
> I figure it will have to be somehow implemented into the
> onmousedown,
> however I am unsure of how to do this.
>
> I have a simple password code that works when added to the beginning
> of
> my html code for when a page is opened, which is:
>
> <SCRIPT language="JavaScript">
> <!--hide
>
> var password;
>
> var pass1="cool";
>
> password=prompt('Please enter your password to view this page!','
> ');
>
> if (password==pass1)
> alert('Password Correct! Click OK to enter!');
> else
> {
> window.location="http://www.pageresource.com/jscript/jpass.htm";
> }
>
> //-->
> </SCRIPT>
>
>
> I also found this code within the search groups:
>
> <!-- Begin
>
>
> function click() {
> if (event.button==2) {
> alert('Sorry, on the login page you cannot right-click. This is for
> security reasons.');
>
>
> }
> }
>
>
> document.onmousedown=click
>
> function Login(){
> var done=0;
> var username=document.login.username.value;
> username=username.toLowerCase();
> var password=document.login.password.value;
> password=password.toLowerCase();
> if (username=="user1" && password=="pass1") {
> window.location="logged.htm"; done=1; }
> if (username=="user2" && password=="pass2") {
> window.location="logged.html"; done=1; }
> if (username=="user3" && password=="pass3") {
> window.location="logged.html"; done=1; }
> if (username=="user4" && password=="pass4") {
> window.location="logged.html"; done=1; }
> if (done==0) { alert(" Login failure. Try again. "); }
>
>
> //The following are the greetings for each user
>
>
> if (username=="user1" && password=="pass1") { alert(" Hello User1!
> "); }
> if (username=="user2" && password=="pass2") { alert(" Hello user2!
> "); }
> if (username=="user3" && password=="pass3") { alert(" Hello user3!
> "); }
> if (username=="user4" && password=="pass4") { alert(" Hello user4!
> "); }
>
>
>
> }
>
>
> // End -->
>
>
>
> But I have no idea where to enter the code into the current html
> code.
> If anyone could help me with this I would greatly appreciate it.
> Unless
> someone has a better idea that will work too.
>
> Thanks,
> Justine
>



 
Reply With Quote
 
JNariss@gmail.com
Guest
Posts: n/a
 
      30th Jan 2006
Wow........this is great info. Thanks Ron. I can't even believe I did
not think about viewing the source code and revealing the password for
all to see!!!!! I will read up on the articles you have supplied me
with and implement another idea.

Thanks Again.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control Dev. - OnMouseDown not called when ContextMenu set =?Utf-8?B?U3RyaWRlcg==?= Microsoft Dot NET Compact Framework 2 4th Mar 2007 08:04 PM
TextBox does not get OnMouseDown and OnMouseUp? Hilton Microsoft Dot NET Compact Framework 2 28th Jun 2006 07:16 AM
Help with Code: OnMouseDown SF Microsoft Access Form Coding 1 20th Jun 2006 10:20 AM
How to handle OnMouseDown event from custom Control when it has ContextMenu? Qualitea Microsoft Dot NET Compact Framework 4 5th Apr 2006 05:21 PM
ContextMenu and OnMouseDown in custom control Andreas Selle Microsoft Dot NET Compact Framework 0 8th Jul 2004 10:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:57 AM.