Jump to content
xisto Community
Sign in to follow this  
coolcat50

Lottery Script Help

Recommended Posts

I have written a simple lottery script that I want to manually use with my InvisionPlus forum and main web site. Currently I have a page with the lottery script on my main page that can be accessed from a redirection forum on my forums. The script creates a button on the lottery page of my main site that creates a number entry prompt that acts as a password field. If the lotto number is correct, then my user is taken to my winners forum where they post they won. The purpose of the lotto is for members to win account upgrades. My script though is not working. Here is the script. I have taken out certain info though.My script

<script type="text/javascript">function lotto1(){ var lottoentry; var lottonum="12345"; lottoentry=prompt("Enter your lotto number here.");if (lottoentry == lottonum)  alert("You have won! Click to submit your winnings.");  alert("Forum pass is *******.");  //I need a redirect code here.;else  alert("Sorry, try again!");  //Another redirect code.;}</script>

My execution form

<form><input type="button" name="lotto" value="Click to Play!" onClick="lotto1()"></form>

Share this post


Link to post
Share on other sites

What specifically doesn't work with this script?If nothing comes up at all, make sure you've closed all of your HTML tags, and if that doesn't work, try just putting one line of javascript at a time. First make it so it just displays something when you click the button, like:document.write("You clicked a button. Yay for you!");If that doesn't work, then you know it's probably not even calling the function. If it does work, keep adding lines of your original code, preferably one at a time, until it stops working, then you know there's something wrong with that line.That's basic debugging skills.Girls only like guys who've got good skills! Gosh! :P ...Sorry if I misquoted Napoleon.

Share this post


Link to post
Share on other sites

Well, the button is simply not working but now I'm using Xisto and I have created a PHP one that emails me.

Yea i know what the problem is coolcat51. I used to have this a lot of times.
all codes go here....LOOK IN YOUR prompt CODE..this is the correct one :lottoentry=prompt("enter a number","");
you see, in prompts, you have to put ".""or ","" in the ending or whatever mark you want there. "?"" "s"" ..etc i stick to ",""

Share this post


Link to post
Share on other sites

You shouldn't use javascript for that. Javascript is client side, so the output can be manipulated by the browser.Also, i noticed you put the "winning number" in the source code, which means, if someone wanted, they would just have to write a simple script to submit that number to the processing script.Also, if you are generating a number with javascript, anyone who could be bothered, could just change the random number equation in the browser, so it would output that number.You should use PHP instead.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.