sailormoon164
06-10-2007, 02:59 AM
I'm trying to use this Javascript code and I keep getting this error I dont know how to fix it
error:
unterminated string constant
line: 88
char: 158
code: 0
HTML code:
<DIV> </DIV>
<TABLE cellSpacing=0 cellPadding=3 bgColor=#000000 border=0>
<TBODY>
<TR>
<TD width="100%">
<P><FONT color=#ffff00 size=4>Crystal Ball</FONT></P><FONT color=#ccccff>
<P>Please enter a yes/no question and it will respond</P>
<P>Warning: the crystal ball has a tendency to be sarcastic!</P>
<TABLE width="40%" border=0>
<TBODY>
<TR>
<TD>
<FORM name=input1><INPUT size=63 name=textfield> </FORM></TD></TR></TBODY></TABLE>
<TABLE width="8%" border=0>
<TBODY>
<TR>
<TD>
<FORM><INPUT onclick=getAnswers() type=button value="Ask Me!" name=button1> </FORM></TD></TR></TBODY></TABLE>
<SCRIPT language=JavaScript>
//Crystal Ball Script - By Michael McDermott (mcdemf1@wfu.edu)
//http://www.wfu.edu/~mcdemf1
//Visit JavaScript Kit (http://javascriptkit.com) for
script
function getAnswers() {
time = new Date()
randominteger = time.getSeconds()
if (document.input1.textfield.value == "") {
alert("You dummy! You didnt enter anything into the Crystal Ball!!!")
return
}
if (randominteger <= 3) answer="Did you really think so? Hahaha, I'm laughing now at your pitiful chances."
if ((randominteger >= 4) && (randominteger <= 6)) answer
="Yeah, it's got a 65% chance of happening."
if ((randominteger >= 7) && (randominteger <= 9)) answer ="Oh come on! No way!"
if ((randominteger >= 10) && (randominteger <= 12)) answer ="As sure as I'm made of glass, this is likely to happen."
if ((randominteger >= 13) && (randominteger <= 15)) answer ="Why are you asking A CRYSTAL BALL? Do you really believe the answers?"
if ((randominteger >= 16) && (randominteger <= 18)) answer ="Give me a break, give me a break, break me off a piece of that NO!"
if ((randominteger >= 19) && (randominteger <= 21)) answer ="Good chances lie on the horizon."
if ((randominteger >= 22) && (randominteger <= 24)) answer ="Ask me again, I am restless and overworked."
if ((randominteger >= 25) && (randominteger <= 27)) answer ="Do you know how the Crystal Ball works? There's your answer."
if ((randominteger >= 28) && (randominteger <= 30)) answer ="As the sun is hot, your answer is YES."
if ((randominteger >= 31) && (randominteger <= 33)) answer ="Did you get drunk last weekend? There's your answer."
if ((randominteger >= 34) && (randominteger <= 36)) answer ="Forget about it"
if ((randominteger >= 37) && (randominteger <= 39)) answer ="Yeah, it could happen. 80% chance."
if ((randominteger >= 40) && (randominteger <= 42)) answer ="Hitler has a better chance of raising from the dead."
if ((randominteger >= 43) && (randominteger <= 45)) answer ="If you really think so, then it shall be."
if ((randominteger >= 46) && (randominteger <= 48)) answer ="Who said ambiguous answers were bad? Not me, so YES!"
if ((randominteger >= 49) && (randominteger <= 51)) answer ="You think I'm going to answer that after a day of hard work? Ask again later."
if ((randominteger >= 52) && (randominteger <= 54)) answer
="If you own a pet, yes. Otherwise, no."
if ((randominteger >= 55) && (randominteger <= 57)) answer
="The sun will rise in the east and set in the west. Thank
you Captain Obvious. YES!"
var newWindow = window.open
(","Results","width=300,height=300")
newWindow.document.write("<html><body bgcolor='#000000' text='#FFFFCC' link='#00FFFF' alink='#000066' vlink='#6666FF'>")
newWindow.document.write("<P align='center'><font size='4'
color='#FFFF00'>Your Question:</P><P></P><font size='3'color='#FFFFCC'>")
newWindow.document.write("<P align='center'>" + document.input1.textfield.value + "</P>")
newWindow.document.write("<P></P><P></P><P></P><P align='center'><font size='4' color='#FFFF00'>The Great Crystal Ball Has Answered:</P><P></P>")
newWindow.document.write("<font size='3' color='#FFFFCC'>")
newWindow.document.write("<P align='center'>" + answer + "</P>")
newWindow.document.write("<P></P><P></P><P align='center'><A href="javascript:window.close()" >Close Me</A></P>")
}
</SCRIPT>
</FONT></TD></TR></TBODY></TABLE></DIV>
</DIV>
Here's the link for the original code, but I took out all the lines on mine and my website does that margin thing.
error:
unterminated string constant
line: 88
char: 158
code: 0
HTML code:
<DIV> </DIV>
<TABLE cellSpacing=0 cellPadding=3 bgColor=#000000 border=0>
<TBODY>
<TR>
<TD width="100%">
<P><FONT color=#ffff00 size=4>Crystal Ball</FONT></P><FONT color=#ccccff>
<P>Please enter a yes/no question and it will respond</P>
<P>Warning: the crystal ball has a tendency to be sarcastic!</P>
<TABLE width="40%" border=0>
<TBODY>
<TR>
<TD>
<FORM name=input1><INPUT size=63 name=textfield> </FORM></TD></TR></TBODY></TABLE>
<TABLE width="8%" border=0>
<TBODY>
<TR>
<TD>
<FORM><INPUT onclick=getAnswers() type=button value="Ask Me!" name=button1> </FORM></TD></TR></TBODY></TABLE>
<SCRIPT language=JavaScript>
//Crystal Ball Script - By Michael McDermott (mcdemf1@wfu.edu)
//http://www.wfu.edu/~mcdemf1
//Visit JavaScript Kit (http://javascriptkit.com) for
script
function getAnswers() {
time = new Date()
randominteger = time.getSeconds()
if (document.input1.textfield.value == "") {
alert("You dummy! You didnt enter anything into the Crystal Ball!!!")
return
}
if (randominteger <= 3) answer="Did you really think so? Hahaha, I'm laughing now at your pitiful chances."
if ((randominteger >= 4) && (randominteger <= 6)) answer
="Yeah, it's got a 65% chance of happening."
if ((randominteger >= 7) && (randominteger <= 9)) answer ="Oh come on! No way!"
if ((randominteger >= 10) && (randominteger <= 12)) answer ="As sure as I'm made of glass, this is likely to happen."
if ((randominteger >= 13) && (randominteger <= 15)) answer ="Why are you asking A CRYSTAL BALL? Do you really believe the answers?"
if ((randominteger >= 16) && (randominteger <= 18)) answer ="Give me a break, give me a break, break me off a piece of that NO!"
if ((randominteger >= 19) && (randominteger <= 21)) answer ="Good chances lie on the horizon."
if ((randominteger >= 22) && (randominteger <= 24)) answer ="Ask me again, I am restless and overworked."
if ((randominteger >= 25) && (randominteger <= 27)) answer ="Do you know how the Crystal Ball works? There's your answer."
if ((randominteger >= 28) && (randominteger <= 30)) answer ="As the sun is hot, your answer is YES."
if ((randominteger >= 31) && (randominteger <= 33)) answer ="Did you get drunk last weekend? There's your answer."
if ((randominteger >= 34) && (randominteger <= 36)) answer ="Forget about it"
if ((randominteger >= 37) && (randominteger <= 39)) answer ="Yeah, it could happen. 80% chance."
if ((randominteger >= 40) && (randominteger <= 42)) answer ="Hitler has a better chance of raising from the dead."
if ((randominteger >= 43) && (randominteger <= 45)) answer ="If you really think so, then it shall be."
if ((randominteger >= 46) && (randominteger <= 48)) answer ="Who said ambiguous answers were bad? Not me, so YES!"
if ((randominteger >= 49) && (randominteger <= 51)) answer ="You think I'm going to answer that after a day of hard work? Ask again later."
if ((randominteger >= 52) && (randominteger <= 54)) answer
="If you own a pet, yes. Otherwise, no."
if ((randominteger >= 55) && (randominteger <= 57)) answer
="The sun will rise in the east and set in the west. Thank
you Captain Obvious. YES!"
var newWindow = window.open
(","Results","width=300,height=300")
newWindow.document.write("<html><body bgcolor='#000000' text='#FFFFCC' link='#00FFFF' alink='#000066' vlink='#6666FF'>")
newWindow.document.write("<P align='center'><font size='4'
color='#FFFF00'>Your Question:</P><P></P><font size='3'color='#FFFFCC'>")
newWindow.document.write("<P align='center'>" + document.input1.textfield.value + "</P>")
newWindow.document.write("<P></P><P></P><P></P><P align='center'><font size='4' color='#FFFF00'>The Great Crystal Ball Has Answered:</P><P></P>")
newWindow.document.write("<font size='3' color='#FFFFCC'>")
newWindow.document.write("<P align='center'>" + answer + "</P>")
newWindow.document.write("<P></P><P></P><P align='center'><A href="javascript:window.close()" >Close Me</A></P>")
}
</SCRIPT>
</FONT></TD></TR></TBODY></TABLE></DIV>
</DIV>
Here's the link for the original code, but I took out all the lines on mine and my website does that margin thing.