View Single Post
  #1 (permalink)  
Old 05-22-2008, 02:33 PM
sakishrist's Avatar   
sakishrist sakishrist is offline
Learning Programmer
 
Join Date: Dec 2007
Location: Greece - Syros
Posts: 84
Credits: 0
Rep Power: 5
sakishrist is on a distinguished road
Send a message via MSN to sakishrist Send a message via Skype™ to sakishrist
Lightbulb JavaScript working in IE but not in Firefox

Hello, I decided to begin learning some JS so my level is 'beginner', and now I faced a strange problem: my script works in IE (even if it first asks me to allow it) but it doesn't in firefox. Here is the script.
HTML Code:
<html>

<head>
<style type='text/css'>
TH {text-align:right};SPAN {vertical-align:bottom};
</style>
<script language='JavaScript'>
var fifteenth = new Date();var sixteenth = 6;var seventeenth = 3;
function eighteenth() {	with(document.all) {		nineteenth.style.setExpression('width','fifteenth.getHours() * sixteenth * seventeenth','jscript');		twentieth.setExpression('innerHTML','fifteenth.getHours()','jscript');		first2.style.setExpression('width','fifteenth.getMinutes() * sixteenth','jscript');		second2.setExpression('innerHTML','fifteenth.getMinutes()','jscript');		third2.style.setExpression('width','fifteenth.getSeconds() * sixteenth','jscript');		fourth2.setExpression('innerHTML','fifteenth.getSeconds()','jscript')    }		fifth2();}
function fifth2() {	fifteenth = new Date();	document.recalc();	setTimeout('fifth2()',1000);}window.onload=eighteenth;
</script>



<title></title>

</head>

<body>


<TABLE BORDER=0><TR>	<TH>Hours:</TH>	<TD>
<SPAN ID='nineteenth' STYLE='background-color:red'></SPAN>&nbsp;
<SPAN ID='twentieth'></SPAN></TD></TR><TR>
<TH>Minutes:</TH>	<TD>
<SPAN ID='first2' STYLE='background-color:yellow'></SPAN>&nbsp;
<SPAN ID='second2'></SPAN></TD></TR><TR>
<TH>Seconds:</TH>	<TD>
<SPAN ID='third2' STYLE='background-color:#00FF40'></SPAN>&nbsp;
<SPAN ID='fourth2'></SPAN></TD></TR></TABLE>
</body>

</html>
If I'm right firefox did not accept this: STYLE='background-color:red'
I got to this conclusion because I did some tests with the lines that have 'STYLE' (but I first deleted everything else to make sure it is not affected by the JScript) and IE accepts them but firefox does not show any colored areas at all.
Reply With Quote

Sponsored Links