Click to See Complete Forum and Search --> : Undefined


lucas
02-15-2003, 10:57 PM
Can someone tell me what to look for when it tells you

'displayJS' Undefined



Thanks LaDonna

khalidali63
02-15-2003, 11:07 PM
displayJS is a variable that is not declared and defined in the current document.

var x;
alert(x)

will result in "undefined"

Hope this helps

Khalid

lucas
02-15-2003, 11:12 PM
Below is my code will you look at it and tell me what is wron I am trying to get a dialog book to come up when I hit the button.

Please Thanks

khalidali63
02-16-2003, 12:00 AM
check the code out..there were few errors I have fixed them...but you still were missing some functionality code.

cheers

Khalid

cheese_stinks
02-16-2003, 12:15 AM
Below is the partially fixed code. It was pretty messed up the way you had it:
1. </body> instead of <body>
2. missing } after function
3. unescaped quotes (")
4. I forgot
I fixed these, but I don't understand what you're trying to do in the displayJS function.

<html>
<head>
<title> Hardware Feedback Form</title>
<body bgcolor="#FFFF99" text="993333">
<h2 align="center"> Hardware Supply Store Feedback Form</h2>
<body>
<p><form name ="firmhardware" method="post">
<b>What about us do you want to comment on? </b><br><br>
<align="right">
<p><input type="text" value"0" name="txtComment" size="50%">
</a><br>
<br>
<b>How did you hear about our web site? </b><br><br>
<select size="0" name = "IstSource" onChange="cp()">
<option value = "Yahoo">Yahoo</option>
<option value = "Commercial">Commercial</option>
<option value = "Magazine">Magazine</option>
<option value = "E-Mail">E-Mail</option>
<option value = "Friend">Friend</option>
<option value = "Other">Other</option>
</select></form>
<br>
<br>
<b>Contact Information </b><br><br>

<p>Name
<input type="text" value"0" name="txtName" size="50"><br>
<p>E-Mail
<input type="text" value"0" name="txtEmail" size="50%">
<br>
<br>
<input type="checkbox" value"0" name="chkEList" size="0">
Please enter me on your email list.
<br>
<br>

<input type = "button" value="Send Us Feedback" name="btnSubmit1"
onclick="displayJS";>

<input type = "button" name = "btnCall2"
value = "Clear Form">

<script language = "javascript">

function displayJS(){
var strComment, strSource, strName, strEmail, strEList;
gblstrComment = document.displayJS.txtComment;
gblstrSource = document.displayJS.IstSource;
gblstrName = document.displayJS.txtName;
gblstrEmail = document.displayJS.txtEmail;
gblstrEList = document.displayJS.chkEList;
}

document.writeln("<html><head></head>");
document.writeln("<body bgcolor=\"#FFFF99\" text=\"#993333\">");
document.writeln("<h2> Hardware Supply Store Form Results</h2>");
document.writeln("<hr hrcolor=\"#800000\">")
</script>

</body>
</html>

kell_y
02-16-2003, 12:30 AM
Hi,

The file you attached is error prone. I'm attaching a working version with some corrections. This is one way of doing it. You can compare the difference to the original one to see what you've done wrong. Hope this help. You can change the file extension to html to see the effect.