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
https://forums.phpfreaks.com/topic/72356-html-doctype-help/
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
https://forums.phpfreaks.com/topic/72356-html-doctype-help/#findComment-366081
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.