Entry Code

E

eXploDe

Hiya,
I am currently designing a new website & wish for users to read the
disclaimer, so I have used a script to call a code from a list. The
only problem is validating the code. Here is my current code:

<script language="JavaScript" type="text/javascript">

<!--
var photos = 9;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % photos;
ad +=1;
if (ad==1) {
alt=3957;
}
if (ad==2) {
alt=2395;
}
if (ad==3) {
alt=2645;
}
if (ad==4) {
alt=1029;
}
if (ad==5) {
alt=2048;
}
if (ad==6) {
alt=9683;
}
if (ad==7) {
alt=3948;
}
if (ad==8) {
alt=1389;
}
if (ad==9) {
alt=3745;
}
document.write(' ' + alt + ' \ ');
}
// -->
</script>

<script language="JavaScript" type="text/javascript">
<!--
function valid(form) {
var field = form.age;
var userAge = parseInt(field.value);
if (!userAge = " + alt + ") {
alert("You must indicate your age.");
return false;
} else if (userAge = " + alt + ") {
return true;
} else {
alert("Incorrect Code. Please read Disclaimer");
field.focus();
field.select();
return false;
}
}
// --></script>

<FORM METHOD="GET"
ACTION="index-frameset.html"
ENCTYPE="text/plain"
onSubmit="return valid(this)">
Your age:<BR><INPUT TYPE="text" NAME="age" SIZE="2">
<INPUT TYPE="button" VALUE="Enter">

The Entry code is displayed elsewhere.

Hope someone understands my attempt,
Please either email a reply, or post a reply.

Thanks, Chris
 
J

Jim Buyens

-----Original Message-----
Hiya,
Howdy.

I am currently designing a new website & wish for users
to read the disclaimer, so I have used a script to call
a code from a list. The only problem is validating the
code. Here is my current code:

...

This is very strange code. For example, the statement

if (userAge = " + alt + ")

assigns the value ' + alt + ' (four spaces, two plus
signs, and the letters a, l, and t) to the value userAge,
and tests to see if that operation was successful.

Can you explain how you actually want this to work?

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*===========----------
|\========--------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/========--------
*===========----------
 
E

eXploDe

Jim Buyens said:
This is very strange code. For example, the statement

if (userAge = " + alt + ")

assigns the value ' + alt + ' (four spaces, two plus
signs, and the letters a, l, and t) to the value userAge,
and tests to see if that operation was successful.

Can you explain how you actually want this to work?

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*===========----------
|\========--------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/========--------
*===========----------

Basically, One JS code randomly selects a group of number from a list
of, then what i want is for the user to enter the group of numbers,
then the other JS code checks that it is correct :)

Cheers, Chris
 
E

eXploDe

Basically, One JS code randomly selects a group of number from a list
of, then what i want is for the user to enter the group of numbers,
then the other JS code checks that it is correct :)

Cheers, Chris

Any Ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top