Cześć
Mam taki kod:
<!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>
i skrypt
document.write(document.images.length);
i wyświetla mi 0, a powinno chyba podać ile jest obrazków na stronie, czyli 1. Wiecie może, co jest nie tak?
Nie działa mi też przykład z książki:
<!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>