Javascript Password - Switch or if/else?

Mmm. Prompts, alerts, modal dialogs ... anything that halts background processes utterly is, as I see it, an artifact of the days when computers were capable of doing only one thing at a time. To entirely lock the user into something that must be handled before they can get on with their work smacks of failure, to me. At the very least it strikes me as questionable UX design.

I realize there are times when some steps must be followed in a specific order of operations, but in my experience, those times aren't geneally as common as many programmers seem to assume.


This is good, the non-secure login on this microsite was supposed to look like a really old CCTV login page. So the prompt, as I see it, was more a success in both the UI and UX design.

Please login into the microsite here: and use serial number 7676
Here is a link to the package this microsite was a complement to: Frendbox package
I would really appreciate your thoughts on the additional pages within. :smile:

I do agree that using a form is a much less obtrusive method for getting user input.

Sure, there are, as I mentioned, times when that sort of thing is necessary, and particularly in this case it's not especially egregious. :wink: By and large, though, modality might indicate a need to restructure a workflow to be more accommodating, or at least less linear.

Cute concept, by the way.

Hi Mark,

I can do the same but using the radio button?

I tried, but I had a problem. When I select any radio button, always is directed to the same scene. (42.8 KB)

i will have a look at it when I get a min.

The way you are doing it you will always get the initial value.

Set your check box code to :

  <input type="radio" id="psswd" name="name" value="jaNE" checked=""> Jane<br>
  <input type="radio" id="psswd" name="name" value="JohN"> John<br>  
  <input type="radio" id="psswd" name="name" value="jiM"> Jim<br>

Now when you check one of the check boxes we will check for the checked property and get it’s inputs value.

So the function would look like this:

	var checkedValue = document.querySelector('#psswd:checked').value;
	console.log( checkedValue );
	{pwd = checkedValue;
if (pwd !== "") {

 hypeDocument.showSceneNamed(pwd, hypeDocument.kSceneTransitionCrossfade);

hypeDocument.showSceneNamed("Denied", hypeDocument.kSceneTransitionInstant);
} else {
hypeDocument.showSceneNamed("Denied", hypeDocument.kSceneTransitionInstant);


It goes without saying that this is not a secure way of doing passwords.


Thank you. Now, It is working perfect.

I know I am a little late, but this code should use a function to eliminate repetition. You could also use a dictionary with the attempted password and scene name as key-value pairs.

It would be a lot easier to maintain.