Jump to content

html DOCTYPE help


prakash

Recommended Posts

I cannot have javascript field validation with the doctype

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

how can I use javascript field validation with using the same doctype.

 

my code is as below

 

<!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">
<head>
<title> new document </title>
<script language="JavaScript" type="text/javascript">
<!--
function chkLoginValid() {
if (login.memberEmail.value=="") {
	alert("E-Mail Required.");
	login.memberEmail.focus();
	return (false);
} else if (login.memberEmail.value.indexOf('@')==-1 || login.memberEmail.value.indexOf('.')==-1) {
	alert("Invalid E-Mail.");
	login.memberEmail.focus();
	return (false);
} else if (login.memberPassword.value=="") {
	alert("Password Required.");
	login.memberPassword.focus();
	return (false);
} else {
	return (true);
}
}
//-->
</script>
</HEAD>
<BODY>
<form name="login" method="post" action="memberAction.php" onSubmit="return chkLoginValid();">
E-Mail Address: <input type="text" name="memberEmail" /><input type="hidden" name="cmd" value="_memberLogin" /><br>
Password: <input type="password" name="memberPassword" /><br>
<input type="submit" value="Login">
</form>
</body>
</html>

Link to comment
Share on other sites

I know. that is just the TEMPLATE of a doctyp,e if you run that throuh regular matching on a text filed then the user could enter any of hte following and be allowed through:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD *//EN" "http://www.w3.org/TR/*">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 

Do you; understand what I mean though, wildcard matching...?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.