javascript help
Posted: Sat Mar 25, 2006 2:18 pm
im really not sure why this code dosnt work, im somewhat new at javascript so yea any help or links are greatly appreciated, its suppose to be a dyanmic imagemap background that also sets a hidden variable to post data, its suppose to alert you of what 'num' is but it wont work with variables just strings, so im not sure how to get the alerts to work either:
its just displaying a blank page.
Code: Select all
<script language="Javascript">
document.write('<html>');
document.write('<head>');
document.write('<title>Star Rating</title>');
document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
document.write('</head>');
document.write('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
alert (num);
function star(num) {
int num;
if (num=='') {
num = 1;
}
int
document.write('<img src="star' + num + '.gif" width="80" height="15" border="0" alt="" usemap="#stars_Map">');
decument.write('<input type="hidden" name="rating" value="' + num + '">');
}
alert (num);
document.write('<map name="stars_Map">');
document.write('<area shape="rect" onMouseover="star(1)" alt="Rate 5" coords="64,0,79,15" href="5.html">');
document.write('<area shape="rect" onMouseover="star(2)" alt="Rate 4" coords="48,0,63,15" href="4.html">');
document.write('<area shape="rect" onMouseover="star(3)" alt="Rate 3" coords="32,0,47,14" href="3.html">');
document.write('<area shape="rect" onMouseover="star(4)" alt="Rate 2" coords="16,0,31,14" href="2.html">');
document.write('<area shape="rect" onMouseover="star(5)" alt="Rate 1" coords="0,0,15,14" href="1.html">');
document.write('</map>');
document.write('</body>');
document.write('</html>');
</script>