Go Back   HTMLCenter Web Development Forums > Web Design and Development > Programming and Scripting
Connect with Facebook

Mac/IE + JavaScript = Nightmare!

Closed Thread
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 05-16-2006, 05:31 AM
Registered User
 
Join Date: May 2006
Posts: 6
Mac/IE + JavaScript = Nightmare!

Hi all....

The following Javascript does not seem to work using IE on a MAC. The images do not display. Seems to work OK using Safari and all browsers on a PC.

The script creates a slideshow of images.

Any suggestions? Much appreciated!....

<script type="text/javascript"><!--
function GotoPic(Num){
location.href=location.pathname+'?'+Num;
}

N=-1;Picture=new Array;
N++;Picture[N]="imagename.jpg";
N++;Picture[N]="imagename2.jpg";
N++;Picture[N]="imagename3.jpg";
N++;Picture[N]="imagename4.jpg";

var ThisPic;
var PrevPic;
var NextPic;
var ShowPrev;
var ShowNext;

if (location.search){
ThisPic=location.search.substring(1)*1;
}else{
ThisPic=0;
}

NextPic=ThisPic+1;ShowNext=(NextPic>(Picture.lengt h-1)?false:true);
PrevPic=ThisPic-1;ShowPrev=(PrevPic<0?false:true);

if (ShowPrev){
document.writeln('<a href="javascript:GotoPic(PrevPic)"><img src="navigation/previous.jpg" width="75" height="23" border="0"></a><img src="navigation/blank.jpg"> ');
}
if (ShowNext){
document.writeln('<a href="javascript:GotoPic(NextPic)"><img src="navigation/next.jpg" width="37" height="23" border="0"></a> ');
}
document.write('</P><img src="'+Picture[ThisPic]+'">');
// -</script>

  #2 (permalink)  
Old 05-17-2006, 07:34 AM
Registered User
 
Join Date: May 2006
Posts: 6
A live version of the site can be found here (in case this helps):

www.thorogood.net

And here is a page (one of many) using the script itself:

http://www.thorogood.net/royknipe_portfolio.htm
  #3 (permalink)  
Old 05-17-2006, 07:38 AM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Save yourself the hassle. It's pointless to make anything work in IE on MAC. IE is dead on the MAC, no longer being developed. The majority of users utilize Safari, and then Firefox, and then maybe Camino.

That is what "we" test with.
  #4 (permalink)  
Old 05-17-2006, 09:16 AM
Registered User
 
Join Date: May 2006
Posts: 6
Problem is.... I sent the redesign to 31 illustrators (who appear on the site). Of those, 3 or more were unable to view that script. They were using IE/MAC. I think as the bulk of creatives (the sites target audience) use Macs the site will receive above average traffic from those using IE/MAC.
  #5 (permalink)  
Old 05-17-2006, 09:23 AM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Well, that's probably people with OS9 or others who are just nuts.

What error do you get from IE? A lot of JavaScript is not even implemented on it. Just make sure you test your objects before you use them.

For example, assuming "location.href" to be there, is not a good idea. IMO, it should be "window.location.href" anyway. And so on, and so on.
  #6 (permalink)  
Old 05-17-2006, 09:31 AM
Registered User
 
Join Date: May 2006
Posts: 6
To be honest, I am not a developer. I asked around on the JavaScript forums (googled etc) to find that script in the 1st place (I did not write it).

Re: Error msgs

I selected 'display errors' within the settings of IE on the Mac but when I visit/load the page - no error msg is displayed from what I can see. I do not use that browser (ever) so perhaps I am looking in the wrong place.
  #7 (permalink)  
Old 05-17-2006, 09:38 AM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Try to substitute the location part then wherever it occurs, and check if it still works.

Old:
Code:
location.href=location.pathname+'?'+Num;
New:
Code:
window.location.href=window.location.pathname+'?'+Num;
  #8 (permalink)  
Old 05-17-2006, 10:05 AM
Registered User
 
Join Date: May 2006
Posts: 6
Thanks! Really appreciate your help.
I made the changes and uploaded a test page:

http://www.thorogood.net/testing/till.htm

Still nothing in IE/MAC. No error msg pops up (i discovered thats how it alerts you).
  #9 (permalink)  
Old 05-17-2006, 10:50 AM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Fix this:
Code:
// -</script>
With:
Code:
//-->
</script>
Also:
Code:
<script type="text/javascript">
With this:
Code:
<script language="JavaScript" type="text/javascript">
(Maybe you even need a version-attribute for IE?)

Also, regarding general JavaScript code, this is how you initialize a variable:

Code:
var N = 0; // integer, not a string :-)
I am not sure if there is anything else missing, maybe it's even more picky. The code doesn't look like it's too much ahead of IE.
  #10 (permalink)  
Old 05-17-2006, 10:59 AM
Registered User
 
Join Date: May 2006
Posts: 6
You did it!!!!!

Thank you so much for your help! I will go and rework all 31 pages now... fun fun fun! :-)

Much appreciated. You are a star.




Your working edit:

www.thorogood.net/testing/till.htm
  #11 (permalink)  
Old 05-17-2006, 11:03 AM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Quote:
Originally Posted by mejust
You are a star.




Pleasure!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Javascript Help elTGray Programming and Scripting 2 03-15-2006 02:42 PM
Javascript problem in setting URL gilgalbiblewhee Programming and Scripting 2 03-07-2006 02:34 PM
Javascript and radio buttons byteme Programming and Scripting 1 01-24-2006 03:51 PM
How do I take <%=Keyword%> in Javascript and break it down to arrays? gilgalbiblewhee Programming and Scripting 3 01-23-2006 12:13 PM
Trying to combine Slideshow javascript and transparent PNG files moez Programming and Scripting 0 01-23-2006 10:38 AM


All times are GMT -5. The time now is 02:24 AM.

 
Clicky Web Analytics
CloudContacts
Loop11
Add On Con


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.0
© 1997-2009 HTMLCenter