ahmed-hitec
Aug 10th 2007, 4:14 pm
Hi,
i am new in JavaScript and have a small problem
i am currently reading the "JavaScript complete reference" e-book, and the following example, about JavaScript entities doesn't work on Firefox 2.0.06
it works fine on ie7. the code is as follows :
<head>
<script language="javascript1.5">
var Bordersize=5;
var tablecellcolor="#ff0000";
var alignment = "center";
function setImage (){
var today = new Date();
var hours = today.getHours();
if ((hours >8) && (hours < 18))
return 'Sunset.jpg'
else
return 'moon.jpg';
}
</script>
</head>
<body>
<table border="&{Bordersize };" align="&{alignment };">
<tr>
<td bgcolor="&{tablecellcolor };">Java script entities</td>
</tr>
</table>
In the sky now : <img src="&{setImage() };" />
</body>
The entities in red should reefer to the variables declared and initialized in the head tag, and it does so but only in ie7,
I need your help, does Firefox is not fully compatible with JavaScript, I don't think so !
i am new in JavaScript and have a small problem
i am currently reading the "JavaScript complete reference" e-book, and the following example, about JavaScript entities doesn't work on Firefox 2.0.06
it works fine on ie7. the code is as follows :
<head>
<script language="javascript1.5">
var Bordersize=5;
var tablecellcolor="#ff0000";
var alignment = "center";
function setImage (){
var today = new Date();
var hours = today.getHours();
if ((hours >8) && (hours < 18))
return 'Sunset.jpg'
else
return 'moon.jpg';
}
</script>
</head>
<body>
<table border="&{Bordersize };" align="&{alignment };">
<tr>
<td bgcolor="&{tablecellcolor };">Java script entities</td>
</tr>
</table>
In the sky now : <img src="&{setImage() };" />
</body>
The entities in red should reefer to the variables declared and initialized in the head tag, and it does so but only in ie7,
I need your help, does Firefox is not fully compatible with JavaScript, I don't think so !