Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Java Help

Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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: 80
Rep Power: 4
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-22-2008, 04:20 PM
acwclassic's Avatar   
acwclassic acwclassic is offline
Newbie
 
Join Date: Mar 2008
Location: sweden
Posts: 25
Rep Power: 3
acwclassic is on a distinguished road
Default Re: JavaScript working in IE but not in Firefox

in firefox chose "preferences" then "web settings" and there you can enable javascript aswell as java.
and javascript isnt the same as java which is a high level programming language.
http://forum.codecall.net/javascript-css/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-22-2008, 06:00 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,398
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default Re: JavaScript working in IE but not in Firefox

I get the following errors:
nineteenth.style.setExpression is not a function
Non-standard document.all property was used. Use W3C standard document.getElementById() instead.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-01-2008, 08:14 AM
CygnetGames's Avatar   
CygnetGames CygnetGames is offline
Programmer
 
Join Date: May 2007
Location: York, England
Posts: 113
Rep Power: 6
CygnetGames is on a distinguished road
Default Re: JavaScript working in IE but not in Firefox

One way to get around some of the incompatibilities between browsers (and make writing code easier) is to use a library like iQuery. While you might want to use document.all in IE, but document.getElementById() in FireFox, jQuery will work out for you which to use - you just use a single jquery function and your code works on different browsers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-02-2008, 11:13 AM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,852
Last Blog:
Web slideshow in JavaS...
Rep Power: 78
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: JavaScript working in IE but not in Firefox

Try fireBug. You can debug your scripts. The Web Developer toolbar might come in handy, too.
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 06-10-2008, 12:57 PM
jsoreno jsoreno is offline
Newbie
 
Join Date: Jun 2008
Posts: 3
Rep Power: 0
jsoreno is on a distinguished road
Smile Re: JavaScript working in IE but not in Firefox

Java is such a big help for all this stuff. . I really want to know more about java. .
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-15-2008, 02:42 PM
satya5321 satya5321 is offline
Newbie
 
Join Date: Dec 2007
Posts: 8
Rep Power: 0
satya5321 is on a distinguished road
Default Re: JavaScript working in IE but not in Firefox

there is some specific syntax for CSS tags for IE(append # before element .class selector) and FireFox
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
firefox



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nortan Popup Blocker + JavaScript Issue twalters84 JavaScript and CSS 3 03-11-2008 05:47 AM
XSPF not working in firefox? phpforfun HTML Programming 0 02-25-2008 08:33 PM
FireFox Spoofing Bug Jordan Programming News 2 01-04-2008 10:52 AM
Internet Explorer Vs Firefox mona Technology Ramble 15 10-20-2007 11:53 AM
Javascript Problem on Firefox streulich JavaScript and CSS 10 10-17-2006 07:40 PM


All times are GMT -5. The time now is 03:04 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads