User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 427,191 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,235 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

js doesn't work on IE7 and/or vista

Join Date: Nov 2007
Posts: 26
Reputation: chrelad is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
chrelad's Avatar
chrelad chrelad is offline Offline
Light Poster

Solution Re: js doesn't work on IE7 and/or vista

  #4  
Jan 1st, 2008
Hi orr16875,

Security has nothing to do with it as far as I can tell... We are just refering to the DOM elements incorrectly.

Check it out, changed parts are bolded:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>form test</title>

<script type="text/javascript">
<!--
document.write("If this text is displayed, your browser supports scripting!")

function validate(el)
{
  if(el.Fname.value=="")
  {
    alert("Please enter first name");
    el.Fname.focus();
    return false;
  }
  if(el.Lname.value=="")
  {
    alert("Please enter last name");
    el.Lname.focus();
    return false;
  }
  return true;
}
//-->
</script>
<noscript>JavaScript is NOT enabled!</noscript>

</head>
<body>
<form action="mail.php" name="thisForm" id="thisForm" method="post" enctype="text/plain" onSubmit="return validate(this);">

<p>First Name <input type="text" name="Fname" id="Fname" size="30" maxlength="25" /></p>
<p>Last Name <input type="text" name="Lname" id="Lname" size="30" maxlength="25" /></p>
<p>Password &nbsp;&nbsp;<input type="password" name="psswd" size="30" maxlength="8" /></p>

<h4>your favorite food</h4>
<p><input type="checkbox" name="food" value="pizza" checked="checked" />Pizza<br />
<input type="checkbox" name="food" value="chicken" />chicken<br />
<input type="checkbox" name="food" value="eggs" />eggs<br /></p>

<h4>Your gender</h4>
<p><input type="radio" name="gender" value="female" checked="checked" />female<br />
<input type="radio" name="gender" value="male" />male<br /></p>

<p><input type="submit" value="send" /><input type="reset" value="clear" /></p>
</form>

<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a></p>

</body></html>

Works in IE and Firefox!
Reply With Quote  
All times are GMT -4. The time now is 10:12 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC