Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

password protecting a shadowbox function. Please help

Status
Not open for further replies.

luteke

Technical User
Nov 10, 2008
6
GB
Hi,

so the page is
if you click on 'Tide' you can see the password prompt appears. But the problem I am having is that even if you press cancel or do the wrong password a few times it still open up the shadow box.


This is the script for the password protection

Code:
var getPass = function(el){
  var ct = 3, thePrompt = 'Please Enter Your Password', theDefault = ' ', pw = '';
  while(ct-- && pw !== 'pass'){
    pw = prompt(thePrompt, theDefault);
    if(pw === null){ ct = 0; }
    thePrompt = 'Password Incorrect, Please Try Again';
    theDefault = 'Password';
  }
  if(pw === 'pass'){
    Shadowbox.open(el);
  }
  return false;
};

This is an example of how a working (non shadowbox) version works successfully.

I would really appreciate some help with this,
thanks,
Luke

p.s. - I know the protection is very low - I don't care if people can find it in the code - that is not important.
 
I expect that the shadowbox code is being attached to the link, and is being run independently of your code.

You need to read the shadowbox docs to find a way of disabling the functionality on that link and then re-enabling it when the password is correct.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top