help

Reply

Join Date: Nov 2007
Posts: 107
Reputation: kings has a little shameless behaviour in the past 
Solved Threads: 2
kings's Avatar
kings kings is offline Offline
Junior Poster

help

 
0
  #1
Nov 6th, 2008
in my php application i have used onchange and onload javascript function.it is working fine in IE but it is not working in other browsers eg:mozilla,chrome,flock
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: help

 
0
  #2
Nov 6th, 2008
this would be a javascript question. does this relate to php at all?

please give more details.
Last edited by kkeith29; Nov 6th, 2008 at 1:27 am.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 438
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training

Re: help

 
0
  #3
Nov 6th, 2008
It would help to see the code. It's kind of hard to help debug code that you can not see

For the record tho. If it doesn't work in Mozilla and the other standards supporting browsers, it doesn't work.
IE is flawed, so some code that shouldn't work works, but a lot of code that should work doesn't work.

It's always best to create code that works in the standards supporting browsers first (Firefox/Opera/Chrome/etc...) and then apply fixes for the others (others being IE).
If you do it the other way around you'll go insane for sure
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,475
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: help

 
0
  #4
Nov 6th, 2008
I did a bit of searching on the w3 website and found a javascript code which detects what browser you are using. So if it is javascript you are trying to use then the below code allows 2 separate codes to be used, 1 for Internet Explorer while the other js code is for any other browser. So the script is:
  1. <script type="text/javascript">
  2. var browser=navigator.appName;
  3. if (browser="Microsoft Internet Explorer")
  4. {
  5. //Internet explorer code
  6. } else {
  7. //Code for any other browser
  8. }
  9. </script>
And as the comments show in the code box above, you can place separate code for Internet Explorer.

Note: Next time please try and post in the appropriate section as this thread currently has no reference to php other than that the javascript is been echo""; by php.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 438
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training

Re: help

 
0
  #5
Nov 6th, 2008
I would avoid coding to specific browsers, like you suggest.
It is far better to code to available objects, falling back on buggy code only if the standard method isn't available.

For example, to create an AJAX object. Rather than detect the browser and move on from there, like so:
  1. var ajaxObject = null;
  2. if (navigator.appName == "Microsoft Internet Explorer") {
  3. ajaxObject = new ActiveXObject("Msxml2.XMLHTTP");
  4. }
  5. else {
  6. ajaxObject = new XMLHttpRequest();
  7. }
You should check if the standard XMLHttpRequest object exists:
  1. var ajaxObject = null;
  2. if(window.XMLHttpRequest) {
  3. ajaxObject = new XMLHttpRequest();
  4. }
  5. else {
  6. ajaxObject = new ActiveXObject("Msxml2.XMLHTTP");
  7. }
This way, if Microsoft ever catches up on standards, the buggy code will automatically be ignored.
Last edited by Atli; Nov 6th, 2008 at 4:35 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC