/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Newbie needing Help

Alright, I finally got my web form up, and got JS to validate it. There’s only one problem. Before I click the submit button on my form, all of my CSS links work. After I click the submit button, not only does it not take you to the page that it is suppose to, but none of my CSS works. Any idea what is going on?

Here is my page text:

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML//EN”>
<html>
<head>
<title>Melissa’s Hobbies</title>

<script type=”text/javascript”>
<!–
function validate_form ( )
{
valid = true;

if ( document.Contact_Me.first_name.value == “” )

{alert ( “Please enter your First Name.” );
valid = false;}

else

if ( document.Contact_Me.last_name.value == “” )
{alert ( “Please enter your Last Name.” );
valid = false;}

else

if ( document.Contact_Me.email.value == “” )
{alert ( “Please enter a Valid Email.” );
valid = false;}

else

if ( document.Contact_Me.comments.value == “” )
{alert ( “Please enter your Comments.” );
valid = false;}

else
{alert(“Information Sent Successfully!”)}
return valid;
}

//–>

</script>
</head>

<body>
<form name= “Contact_Me” action=”index.html” method=”post” onsubmit=”return validate_form ( );”>

<h1> <B> <font size =”14″ face=”Vivaldi”><IMG src=”http://images2.layoutsparks.com/1/109357/tribal-lotus-very-beautiful.jpg” ALT= “tribal” height=”150″ width=”200″ />Melissa’s Hobbies </font></B> </h1>

<!– Site navigation menu –>
<ul class=”navbar”>
<li><a href=”index.html”>Home page</a>
<li><a href=”aboutme.html”>About Me</a>
<li><a href=”artwork.html”>Artwork</a>
<li><a href=”poetry.html”>Poetry</a>
</ul>

<!– Main content –>
<BODY bgcolor=CFCFE1 TEXT=000000 LINK=0000F7 VLINK=00B8B8 ALINK=0000F7>

<h2> <B> <DIV ALIGN=CENTER><font size =”8″ face=”Vivaldi”><IMG src=”http://web1.d25.k12.id.us/home/syrn/images/ContactUs.jpg” ALT= “contact” height=”40″ width=”40″ /> Contact Me </font> </DIV> </B></h2>

<table border=”1″ bordercolor=”FFFFFF” style=”background-color:CFCFE1″ width=”400″ cellpadding=”3″ cellspacing=”3″>
<tr>
<td>First Name:</td>
<td><input type=”text” name=”first_name” value=”” maxlength=”100″ ></td>
</tr>

<tr>
<td>Last Name:</td>
<td>

<input type=”text” name=”last_name” value=”” maxlength=”100″ /></td>
</tr>
<tr>
<td>Email:</td>
<td><input type=”text” name=”email” value=”” maxlength=”100″ /></td>
</tr>

<tr>
<td>Comments:</td>
<td><textarea rows=”3″ cols=”20″ name=”comments”></textarea></td>
</tr>
<tr><td> </td>
<td>
<input type=”submit” value=”Submit” >
</td>
</tr>
</table>

</form>

</body>
</html>

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@justinbarneskinDec 14.2009 — Lots to work on there. See what you can do with this, I removed an extra body tag, you only get one.
[code=html]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML//EN">
<html>
<head>
<title>Melissa's Hobbies</title>

<script type="text/javascript">
<!--
function validate_form ( ){
var alrt=['Please enter your First Name.','Please enter your Last Name.','Please enter a Valid Email.','Please enter your Comments.']
var f=document.forms[0].elements;
for(i=0;i<f.length;i++){if(!f[i].value){alert(alrt[i]); return}}
document.location='index.html'

}

//-->


</script>
</head>


<BODY bgcolor=CFCFE1 TEXT=000000 LINK=0000F7 VLINK=00B8B8 ALINK=0000F7>


<h1> <B> <font size ="14" face="Vivaldi"><IMG src="http://images2.layoutsparks.com/1/109357/tribal-lotus-very-beautiful.jpg" ALT= "tribal" height="150" width="200" />Melissa's Hobbies </font></B> </h1>

<!-- Site navigation menu -->
<ul class="navbar">
<li><a href="index.html">Home page</a>
<li><a href="aboutme.html">About Me</a>
<li><a href="artwork.html">Artwork</a>
<li><a href="poetry.html">Poetry</a>
</ul>

<!-- Main content -->


<h2> <B> <DIV ALIGN=CENTER>
<font size ="8" face="Vivaldi">
<IMG src="http://web1.d25.k12.id.us/home/syrn/images/ContactUs.jpg" ALT= "contact" height="40" width="40" /> Contact Me </font> </DIV> </B></h2>


<form name= "Contact_Me" method="post" onsubmit=" validate_form ( );return false">

<table border="1" bordercolor="FFFFFF" style="background-color:CFCFE1" width="400" cellpadding="3" cellspacing="3">
<tr>
<td>First Name:</td>
<td><input type="text" name="first_name" value="" maxlength="100" ></td>
</tr>

<tr>
<td>Last Name:</td>
<td>
<input type="text" name="last_name" value="" maxlength="100" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email" value="" maxlength="100" /></td>
</tr>

<tr>
<td>Comments:</td>
<td><textarea rows="3" cols="20" name="comments"></textarea></td>
</tr>
<tr><td> </td>
<td>
<input type="submit" value="Submit" >
</td>
</tr>
</table>

</form>

</body>
</html>[/code]
Copy linkTweet thisAlerts:
@DoubleStar3authorDec 14.2009 — OMG! You are my life saver!

Now can you explain to me how what I had was so wrong, and how yours works? What was the big problem?

I like to try and learn from my mistakes and really appreciate your help!
Copy linkTweet thisAlerts:
@justinbarneskinDec 14.2009 — I don't think its the right time to explain why yours didn't work. There is still lots to work on, you don't even have a document type declaration. I'm sure you'll do something more with your form, its not really doing anything yet.
×

Success!

Help @DoubleStar3 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...