I have a script that works fine, but I’m not sure how to move it to an external .js file.
Here is the script…
[code=html]
<script>
function passWord() {
var testV = 1;
var pass1 = prompt(‘ENTER PASSWORD (member name must also match records)’,’ ‘);
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == “member”) {
window.open(‘http://ww6.aitsafe.com/cf/add.cfm?userid=8579715&product=Discounted+Product&price=20.00’);
break;
}
testV+=1;
var pass1 =
prompt(‘Password Incorrect – Please Try Again.’,’Enter Password’);
}
if (pass1.toLowerCase()!=”password” & testV ==3)
history.go(-1);
return ” “;
}
</script>
<center>
<form>
<input type=”button” value=”Buy as Member” onClick=”passWord()”>
</form>
</center>
What I want to do is move everything to an external file, except this part…
[code=html]http://ww6.aitsafe.com/cf/add.cfm?userid=8579715&product=Discounted+Product&price=20.00
My hope is that I can call that part from the html page itself (without having to retype the script multiple times). There will be lots of links like this on a single page (the only difference being the URL).
[B]Is this possible?
Or is there a better way to do this?
* P.S. I do realize that doing passwords via Javascript is totally insecure as all the buyer needs to do is view source. The client just wanted a mild deterrent and doesn’t care much whether it’s secure or not (as they check member purchases against records either way). Of course, if you DO know of a secure (but still simple) way to do this, I’m all ears! ?