Draygoes
Fully Optimized
- Messages
- 1,663
- Location
- United States
Ok, so I really need to brush up on my Javascript skills, which I have been actively doing.
This is what I need help with. I found a basic password prompt script that I have been using to keep script kiddies off of my page. I am not protecting anything too important, but I dont exactly want traffic. That having been said, I decided to go with this;
The largest modification that I made, was to add "Return;" in place of the alert box that was there. I just want a quick and simple way to exit the code. In most cases, this works fine. However, in IE I get an error message. I will attach a screen cap at the end of this post.
That normally wouldnt be an issue, but I designed a portable app for windows that loads an IE object, then the site so that I dont leave the site in the history of computers that are not mine. (And also because I wanted to.) Another reason that I wish to fix this, is because I wish to learn. Eventually I will be slapping javascript into websites designed for the public, so I need to get back into the habbit.
That was a very long way of saying, that I wish to ask a simple question. I googled for ways to exit a javascript function, and the answer was to use "Return;". Does anyone here know a better way that will not upset IE?
Oh, and it should be noted that it only causes the error message when being ran from my program with the imbedded IE object. Not sure why that makes a difference, but the normal browser doesnt do that.
Thank you all for your time.
And of course, the screen shot...
This is what I need help with. I found a basic password prompt script that I have been using to keep script kiddies off of my page. I am not protecting anything too important, but I dont exactly want traffic. That having been said, I decided to go with this;
Code:
<SCRIPT language="JavaScript">
<!--hide
var password;
var pass1="cool";
password=prompt('Password!',' ');
if (password==password)
{
Return;
}
else
{window.alert("Wrong!");
}
{
window.location="http://google.com";
}
//-->
</SCRIPT>
The largest modification that I made, was to add "Return;" in place of the alert box that was there. I just want a quick and simple way to exit the code. In most cases, this works fine. However, in IE I get an error message. I will attach a screen cap at the end of this post.
That normally wouldnt be an issue, but I designed a portable app for windows that loads an IE object, then the site so that I dont leave the site in the history of computers that are not mine. (And also because I wanted to.) Another reason that I wish to fix this, is because I wish to learn. Eventually I will be slapping javascript into websites designed for the public, so I need to get back into the habbit.
That was a very long way of saying, that I wish to ask a simple question. I googled for ways to exit a javascript function, and the answer was to use "Return;". Does anyone here know a better way that will not upset IE?
Oh, and it should be noted that it only causes the error message when being ran from my program with the imbedded IE object. Not sure why that makes a difference, but the normal browser doesnt do that.
Thank you all for your time.
And of course, the screen shot...