Hi Folks,
I have two issues:
1- I have written following code a code that works in IE but not in firefox. Please see code below. JavaScript version is 1.3. Both browsers should be able to run the script? -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-
<html>
-
<style type="text/css">
-
table {border-collapse: collapse; }
-
TEXTAREA {width:300px; height:200px; border: 0; overflow:hidden;}
-
td {width:30px;padding: 0; margin: 0; border: 1px solid gray;}
-
</style>
-
-
<script Language="javascript">
-
-
function setBorderBold(x)
-
{
-
document.getElementById(x).style.border="0.20em black solid";
-
}
-
-
function setBorderToStandard(x)
-
{
-
document.getElementById(x).style.border="0.05em solid gray";
-
}
-
-
-
</script>
-
-
<body>
-
<form>
-
<table bordercolor="gray"><tr><td id="myid1"><TEXTAREA name="thetext" id="textarea1" onfocus="setBorderBold('myid1')" onblur="setBorderToStandard('myid1')"></textarea></td><td id="myid2"><TEXTAREA name="thetext" maxwidth="400em" id="textarea1" onfocus="setBorderBold('myid2')" onblur="setBorderToStandard('myid2')"></textarea></td></tr></table>
-
</form>
-
</body>
-
</htm>
-
2- Second issue is just a genaral question: which javaScript version is the best to use cosidering the diversity of browsers and incompatibility problems?
Or is there something like a "javaScript Plugin" for browsers, so that each browser could run any version of Javascript provided the plugin is installed?Maybe a silly question, but am a beginner :)
Regards
Bu
2 1212 Dormilich 8,658
Recognized Expert Moderator Expert
1 - you should validate your html, this will certainly solve most problems. (e.g. use <script type="text/javascript">)
2 - don't rely on javascript version. the easiest way is to check for the existance of the function/feature you want to use.
example - if (document.addEventListener()) {
-
// some code
-
}
-
else if (document.attachEvent) {
-
// some code for IE
-
}
-
else {
-
// any error handling (silent fail)
-
}
regards
acoder 16,027
Recognized Expert Moderator MVP @wannasee
If only, if only! Unfortunately, browsers don't always follow standards, some add their own proprietary features, and there are many bugs. Welcome to the frustrating world of cross-browser coding. As Dormilich pointed out, you don't specify the JavaScript version (though JavaScript does have versions). If you want to support older browsers that may not support the method that you want to use, use object/feature detection to avoid errors.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Peter Bremer |
last post by:
Hi all,
I've written this little piece of code, which doesn't seem to work in
Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found
some indication that Netscape 6+ has the same problem. Internet Explorer 6
and Opera 7 have no problems with it.
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN'
'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
<script>document.write (window.history.length);</script>
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |