473,388 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

IE Firefox compatibility

Hi, I'm an IT teacher in England running a BTEC course for A-level students, the unit is 'Client -side cutomisation of web pages' and deals specifically with CSS and Javascript, for 1 of the assessment criteria I need to get students to 'explain how web pages using scripts are implemented in two different browsers', now the obvious browsers there I assume would be IE and Firefox and I will need to set the students a task which will require them to write 2 different implementations of javascript to perform the same task (ie because browser incompatibilities won't run the same code the same way).

Having checked a lot of blogs tonight I'm finding this difficult, particularly as the students are novice coders and the obscurities of the latest bits of W3C DOM to be implemented in latest browser versions is probably beyond their capabilities. So I suppose my question would be 'is there a simple task or procedure in javascript that is required to be written differently for IE and Firefox, thanks, Dave
Nov 6 '07 #1
3 2745
Ferris
101 100+
Hi:
I write an example for you:


[HTML]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>
<input type="button" id="btn_OK" value="OK" />

<script language="javascript" type="text/javascript">
<!--
//for IE
//document.getElementById("btn_OK").attachEvent("onc lick",function(){alert("OK");});
//for FireFox
//document.getElementById("btn_OK").addEventListener ("click",function(){alert("OK");} , false);
//for Both
//document.getElementById("btn_OK").onclick = function(){alert("OK");};
-->
</script>
</body>
</html>


[/HTML]


By the way: if I were you, I will not require my students to write Non-Portable code.


hope it helps.
Nov 7 '07 #2
acoder
16,027 Expert Mod 8TB
I will need to set the students a task which will require them to write 2 different implementations of javascript to perform the same task (ie because browser incompatibilities won't run the same code the same way).
...
So I suppose my question would be 'is there a simple task or procedure in javascript that is required to be written differently for IE and Firefox, thanks, Dave
Check out Browser Bugs, Quirks and Inconsistencies and A Guide to Coding Cross-Browser Scripts which will give you some ideas.

The obvious example as used by Ferris is event handling where IE is notoriously bad (it has its own non-standard model).

Whatever you do, do not use ugly ten-years old code which used to differentiate between IE and Netscape using document.all and document.layers.

Hope that helps.
Nov 7 '07 #3
drhowarddrfine
7,435 Expert 4TB
If this helps, you can check on the level of DOM support in your browser. As you will see, IE is almost 10 years behind while Firefox and Opera are only three or so.
Nov 7 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Niels | last post by:
Hi group, I have some problems with clearing floated divs. My usual method works fine in Konqueror, but not in Firefox. Here's an example: <html><body> <div id='left' style='float:left;...
15
by: 50295 | last post by:
Hi everyone, This one is better experienced than explained, so I'm including a code sample below. Please and save (as an html file) and view with NN or Firefox (or maybe even Mozilla), and then...
36
by: Simon Wigzell | last post by:
I have the following in my webpage: <body onresize=CenterIt(); onMouseMove=mouseCheck(event);> CenterIt and mouseCheck are my own javascript functions. Works fine for IE and Opera, doesn't...
4
by: fcurvat | last post by:
Hello, I've got a little problem with <script></script> under firefox 1.0.7 If the script is not placed in the body tag, it isn't automaticaly executed, but it is under Internet Explorer. ...
5
by: BJ | last post by:
Hi, I add label and text box fields dynamically in code using C# and ASP.NET. I set the width of the label using: Label label = new Label(); label.Width = 20; label.Text = "Test";...
45
by: Pat | last post by:
its seems asp.net validation doesn't fire when using FireFox? Tested a page and it doesn't fire. It seems the javascript doesn't fire Any ideas?
1
by: newspost2000 | last post by:
If anyone could help me out here. I am the webmaster of the following corporate website: http://www.otpp.com/. When I load this page in IE or Netscape for PC the postion of all of the elements on...
3
by: VK | last post by:
A minor Firefox update was released (now 1.5.0.1) Full list of fixes can be found here: <http://www.mozilla.com/firefox/releases/1.5.0.1.html> Unfortunately the same update bans Venkman for...
10
by: Paul Gorodyansky | last post by:
Hi, Ran into the problem today - in INPUT field Firefox executes clean-yp of the content if a user presses Esc, _before_ control goes to the code via onkeydown - and search showed that it's a...
5
by: Charlie | last post by:
Hi: I have some Custom server controls (validated textboxes) in a panel on a form. In Firefox, it looks all hosed up. Also, pictures show place holders while loading. What are my options for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.