HI, I have got sth like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>Szablon JavaScript</title>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-2" />
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="skrypt.js" charset="ISO-8859-2"></script>
</head>
<body>
<img name="obrazek1" src="rys1.gif" />
</body>
</html>
and script:
document.write(document.images.length);
The result of this script is 0, but there is a one image. Anyone knows why it's 0?
And the second example, which doesn't work:
:
<!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”>
<head>
<title>Chapter 6: Example 3</title>
</head>
<body>
<img name=”img1” src=”” border=”0” width=”200” height=”150” />
<script type=”text/javaScript”>
var myImages = new Array(“usa.gif”,”canada.gif”,”jamaica.gif”,”mexico.gif”);
var imgIndex = prompt(“Enter a number from 0 to 3”,””);
document.images[“img1”].src = myImages[imgIndex];
</script>
</body>
</html>
This script should change image if user put different number, but it does NOTHING and I dont know why