I have the following script that could be use in pre-HTML5 and a current HTML5 program.
Is there a way to use the pre-HTML version if the current browser does not support HTML5?
How do you determine if HTML5 is the working browser so that I would know which version of the <input> tag to use?
Note: I don’t know if this is purely a JS problem or just an HTML set-up problem. ?
[code]
<!DOCTYPE HTML>
<html>
<head>
<title> Untitled </title>
<meta charset=”utf-8″>
<script type=”text/javascript”>
// Cross-browser compliant “PlaceHolder” function
// From: http://help.dottoro.com/ljgugboo.php
function ClearPlaceHolder (input) { if (input.value == input.defaultValue) { input.value = “”; } }
function SetPlaceHolder (input) { if (input.value == “”) { input.value = input.defaultValue; } }
</script>
</head>
<body>
<input type=”text” value=”Please fill this field” onfocus=”ClearPlaceHolder(this)” onblur=”SetPlaceHolder(this)” />
<input type=”text” value=”” placeholder=”Zipcode” />
</body>
</body>
</html>