 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Crossrocket.1 Master Cheater
Reputation: 0
Joined: 16 Nov 2007 Posts: 307
|
Posted: Wed Dec 17, 2008 3:30 pm Post subject: IMMMEDIATE JAVASCRIPT HELP NEEDED!! |
|
|
Im doing a madlibs story and ive got 10 mins to do it
i cant do it that fast pleassseee help me
Can u make it so it keeps going when u enter a wrong password? and when u click cancel it goes to the page saying canceled, exit | Code: | <html>
<head>
<title>While loop in-class exercise</title>
<link rel='stylesheet' type='text/css' href='exampleStyle.css'>
<script language="JavaScript">
var UserPass = window.prompt("Please enter password [Madlibsisfun]","") <!--Enter a password to go to madlibs-->
var password = "Madlibsisfun" <!--Password is Madlibsisfun-->
while(UserPass != password && UserPass != "") {
passEnter = window.prompt("Please enter the password","")
if (UserPass == null)
{
alert("Wrong password")<!--Wrong password-->
break
}
}
if (UserPass == password)
{
window.location = "Madlibs2.html" <!--Right password-->
}
</script>
</head>
<body>
<hr>
<h1>Exit, Wrong password</h1>
<hr>
</body>
</html> |
if the password is right, the person goes here: I dont know what i did wrong here, it just doesnt work i dont have a debugger | Code: |
<html>
<head>
<link rel="stylesheet" type='text/css' href='Madstyle.css'>
<title>Santa claus Madlibs!</title>
<script language="Javascript">
function checkForm(frmTemp) {
if (frmTemp.txtAn.value.length<3){
alert("Error: Either you forgot to add a word for an animal or your word is less then 3 words long");
}else if(frmTemp.txtRoom.value.lenght<3){
alert("Error: Either you forgot to add a word for a room or your word is less then 3 words long");
}else if(frmTemp.txtNme.value.lenght<3){
alert("Error: Either you forgot to add a name or your word is less then 3 words long");
} else if(frmTemp.txtFnme.value.lenght<3){
alert("Error: Either you forgot to add a friend's name(1) or the name is less then 3 words long");
} else if(frmTemp.txtFnme2.value.lenght<3){
alert("Error: Either you forgot to add a friend's name(2) or the name is less then 3 words long");
} else if(frmTemp.txtFnme3.value.lenght<3){
alert("Error: Either you forgot to add a friend's name(3) or the name is less then 3 words long");
} else if(frmTemp.txtCol.value.lenght<3){
alert("Error: Either you forgot to add a color or your color is less then 3 words long");
} else if(frmTemp.txtFlo.value.lenght<3){
alert("Error: Either you forgot to add a Florida 'Place' or your place is less then 3 words long");
} else if(frmTemp.txtNycb.value.lenght<3){
alert("Error: Either you forgot to add a Newyork city building or your building is less then 3 words long");
}
}
function showStory(frmTemp){
var newDoc
newDoc="<head><title>How they saved christmas</title><link rel="stylesheet" type='text/css' href='Madstyle.css'>"
newDoc=newDoc + "<center><span class=layer2>MadLibs story. The blue words are the one you wrote </center> </head>"
newDoc=newDoc+"<body>How the </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>s Saved Christmas"
newDoc=newDoc+"On a Christmas Eve, Santa walked over to the </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>s and said </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>! He went on to say that it was too </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2> to fly the sleigh this Christmas. The </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>s were very upset! After Santa left, the </span><span class=base>" +frmTemp.txtAn.value+" </span><span class=layer2>s started to talk. They decided that if they got the lights out of the </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2> they could see well enough to fly."
newDoc=newDoc+"</span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>, who was one of the smarter </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>s, said that they would need electricity though. Another </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2> decided that if they put enough extention cords together they could still go."
newDoc=newDoc+"But where would they get enough extention cords to reach across the world? They went to work! They decided if they took the extention cords from </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>,</span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2> and </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>'s house, then they would have enough but they decided to take only the </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2> ones. "
newDoc=newDoc+"Everything went well but when they got to Florida all of the sudden the sleigh stopped in mid-air. Santa bounced out of the sleigh and fell in to " </span><span class=base>"+frmTemp.txtAn.value+"</span><span class=layer2> ."
newDoc=newDoc+"The </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>s didn't know what to do!"
newDoc=newDoc+"First they flew back to find out why the sleigh stopped. They discovered that the extention cords got caught on the </span><span class=base>" +frmTemp.txtAn.value+" </span><span class=layer2>."
newDoc=newDoc+" They untangled the cord and then flew back to and picked up Santa."
newDoc=newDoc+"So that is how the </span><span class=base>" +frmTemp.txtAn.value+"</span><span class=layer2>s saved Christmas.</body>"
document.write(newDoc)
document.close()
}
function showOstory(frmTemp2){
var newdoc
newDoc="<head><title>How they saved christmas</title>"
newDoc=newDoc + "<body>How the reindeers Saved Christmas. On a Christmas Eve, Santa walked over to the reindeers and said Hello! He went on to say that it was too windy to fly the sleigh this Christmas. The reindeers were very upset! After Santa left the reindeers started to talk. They decided that if they got the lights out of the bathroom, they could see well enough to fly. Rudolph, who was one of the smarter reindeers, said that they would need electricity though. Another reindeer decided that if they put enough extension cords together they could still go. But where would they get enough extension cords to reach across the world? They went to work! They decided if they took the extension cords from John, Mike and Leo's house they would have enough but they decided to take only the red ones. Everything went well but when they got to Florida all of the sudden the sleigh stopped in mid-air. Santa bounced out of the sleigh and fell in to a zoo. The reindeers didn't know what to do! First they flew back to find out why the sleigh stopped. They discovered that the extension cords got caught on the Empire State Building. They untangled the cord and then flew back to the zoo and picked up Santa. So that is how the reindeers saved Christmas.</body>"
document.write(newDoc)
document.close()
}
</script>
</head>
<body>
<body background="Madpic.jpg">
<form name=frmMdlb><center><div id="container">
<tr>
<td>Enter Animal(singular):</td>
<td>
<input type=text name=txtAn size=30 maxlength=200 value="">
</td></tr>
<br>
<tr>
<td>Enter an adjective to describe the weather: :</td>
<td>
<input type=text name=txtWeth size=30 maxlength=200 value="">
</td></tr>
<br>
<tr>
<td>Enter a room in your house: :</td>
<td>
<input type=text name=txtRoom size=30 maxlength=200 value="">
</td></tr>
<br>
<tr>
<td>Enter a name</td><br>
<input type=text name=txtNme size=30 maxlength=200 value="">
</td></tr>
<br>
<tr>
<td>Enter a friend's Name:</td>
<td>
<input type=text name=txtFnme size=30 maxlength=200 value="">
</td></tr>
<br>
<tr>
<td>Enter another friend's name:</td>
<td>
<input type=text name=txtFnme2 size=30 maxlength=200 value="">
</td></tr>
<br>
<tr>
<td>Enter another friend's name:</td>
<td>
<input type=text name=txtFnme3 size=30 maxlength=200 value="">
</td></tr>
<br>
<tr>
<td>Enter a color:</td>
<td><br>
<input type=text name=txtCol size=30 maxlength=200 value="">
</td></tr>
<br>
<tr>
<td>Enter a place in Florida:</td>
<td>
<input type=text name=txtFlo size=30 maxlength=200 value="">
</td></tr>
<br>
<tr>
<td>Enter a NewYork city building:</td>
<td>
<input type=text name=txtNycb size=30 maxlength=200 value="">
</td></tr>
<input class="butts" type="button" value="Create my Santa story!" onClick="checkForm(frmMdlb);showStory(frmMdlb)">
<input class="butts" type="button" value="Show me the orignal story!" onClick="showOstory(frmMdlb)">
</div></center>
</body>
</html> |
_________________
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Wed Dec 17, 2008 3:41 pm Post subject: |
|
|
| Code: | <html>
<head>
<title>While loop in-class exercise</title>
<link rel='stylesheet' type='text/css' href='exampleStyle.css'>
<script language="JavaScript">
var UserPass = window.prompt("Please enter password [Madlibsisfun]","") <!--Enter a password to go to madlibs-->
var password = "Madlibsisfun" <!--Password is Madlibsisfun-->
while(UserPass != password && UserPass == "") {
passEnter = window.prompt("Please enter the password","")
if (UserPass == null)
{
alert("Wrong password")<!--Wrong password-->
break
}
}
if (UserPass == password)
{
window.location = "Madlibs2.html" <!--Right password-->
}
</script>
</head>
<body>
<hr>
<h1>Exit, Wrong password</h1>
<hr>
</body>
</html> |
You're while loop is wrong, it's
| Code: | | while(UserPass != password && UserPass == "") { |
instead of
| Code: | | while(UserPass != password && UserPass != "") { |
Edit: (I'm probably too late anyway)
the second check: && UserPass == "" is actually useless o.o
while(UserPass != password) should be enough
|
|
| Back to top |
|
 |
Crossrocket.1 Master Cheater
Reputation: 0
Joined: 16 Nov 2007 Posts: 307
|
Posted: Wed Dec 17, 2008 6:49 pm Post subject: |
|
|
reak is the most awesomest person ever
_________________
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|