Helping ordinary people create extraordinary websites!

Go Back   Web Development Forum > Website Programming > Server-Side Scripting
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-12-2006, 09:09 PM
Junior Member
 
Join Date: Apr 2006
Posts: 2
Default Java script code problem

i cant the the following code to work it is ment to be a function with a loop which displays the name and values of the form when a button is click;
please help

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>

<script language="text/javascript">

function display() {
for(i=0; i<document.form.elements.length; i++)
{
document.write ("the name is: " + document.form.elements[i].name +
"and the value is:" +
document.form.elements[i].value + "<br/>");
}
}


</script>

<form name= "form">

PLease Enter Your name:<br>
<input type="text" name="elementOne"><p>

What age group are you in?<br>
17-25 Yr<input type="radio" name="age1" value="17-25"><br>
25-35 Yr<input type="radio" name="age2" value="25=35"><p>

What sport do you like best?:<br>
<select name="sport" size="3">
<option>Surfing
<option>Football
<option>Basketball
</select><p>

What is your email address?
<input type="text" name="address">


</form>
<input type="button" value="test" onClick="display()">

</BODY>
</HTML>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-01-2006, 11:25 PM
Junior Member
 
Join Date: May 2006
Posts: 2
Default

THis line <input type="button" value="test" onClick="display()"> should be BEFORE the "</form>".
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
code behind code doesnt work skat Server-Side Scripting 0 01-08-2008 03:47 PM
Best php script site? reach2seo Server-Side Scripting 6 12-10-2007 01:32 PM
problem with mysql and php dharshini Server-Side Scripting 1 07-25-2007 02:43 AM
Java script code problem sarah Forum Members Lounge 0 04-12-2006 09:08 PM


All times are GMT -5. The time now is 03:32 AM.


Website Design by Ducani Media Group
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.