I have
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Function test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<script type="text/javascript">
function doFunction(towindow)
{
towindow.value='2';
}
</script>
</head>
<body>
<div>
<textarea id="outputarea" rows="6" cols="60"></textarea> <br />
<button type="button" onclick="doFunction(outputarea)">doFunction </button>
</div>
</body>
</html>
This does not work. When the button is clicked, then nothing happens.
If I remove the <!DOCTYPE ....
then everything works fine.
I would like to keep the DOCTYPE for validation and I have found this exact declaration from the W3schools website. The code does validate. I am using Firefox 10.0. When I use Chrome 27.0.1453.116 the problem does not occur. Also, the problem does not occur when I use Explorer 10.
It seems like there is a problem between the JavaScript, the DOCTYPE declaration, and Firefox.
What is the problem? How might I fix this?
(I see other questions (see for example this-1, this-2, this-3, this-4) with some of the same question, but they didn't help)