[OT] Browser compatability

Tyler dl-VfU7g9ZgxX7GZwFJSaPsbg at public.gmane.org
Mon Sep 15 16:13:12 UTC 2008


Consider using JQuery (jquery.com) instead of traditional javascript.  
JQuery is built with two things in mind: compatibility and ease of use.

For example, (off the top of my head), here is similar code to what you 
have, done in JQuery:

<script lanugage="Javascript src="jquery-1.2.6.min.js"></script>
<script language="Javascript">
// When the page has loaded...
$(document).ready(function() {
    // Add an event watch for when someone changes any input box
    $(":input").change(function() {
       // When that change happens, do an AJAX request using the URL in 
the <option>'s value
       $.post($(this).val(), function(data) {
          // When we get the data back from the AJAX request, stuff it 
into 'jack'
          $("#jack").html(data);
       });
    });
});
</script>
<select>
<option value="intfoods/canada.txt">Canada</option>
<option value="intfoods/australia.txt">Australia</option>
</select>
<div id="jack"></div>

Tyler



Paul King wrote:
> Hello
>
> Some time ago, I was playing around with Ajax/JavaScript and CSS and while I 
> got both to work in Firefox and Opera browsers, I find that Internet Exlplorer, 
> Safari and Chrome all choke on the Javascript.
>
> All browsers display the CSS all right, but the JavaScript doesn't work in the 
> dropdown menus for IE, Safari, and Chrome.
>
> Strange part is, the Ajax/JavaScript for all browsers seems to work on the link 
> at the bottom of the page that says "How this page was put together". And it 
> indeed work for every browser I tried.
>
> The part that IE chokes on are dropdowns such as:
>
> <form action="POST">
> 	<select>
> 	<option value = "">Select a country</option>
>     <option  value = "Australia" 
>       onclick = "getData('intfoods/australia.txt', 'jack')">Australia
>     </option>
>     </select>
> </form>
>
> The part that works for everybody is a link that I put together with some 
> guesswork:
>
> <a onClick="getData('tech_detail.txt', 'jack')" class="jill"><font
> color="blue">How this page was put together</font></a>
>
> As you can see, both tags call the same function, and send existing files as 
> parameters. Both work as expected under Firefox and Opera. However, under the 
> other browsers, they seem to choke on the form code. Can anyone shed light on 
> this?
>
> The website is at http://testing.alimentarus.net/index.html
>
> Thanks.
>
> Paul King
>
> --
> The Toronto Linux Users Group.      Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
>   
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list