Current location: Hot Scripts Forums » General Web Coding » JavaScript » Safari Screw Up


Safari Screw Up

Reply
  #1 (permalink)  
Old 03-31-08, 05:24 PM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
Safari Screw Up

Does anyone know of how safari uses javascript zindex property as my script works across all browsers but safari. I use a simple javascript function to increase the z value of a div layer (or decrease it) but it just sits in the same place as it was originally scripted. Id post my code but theres no point because its been checked in the following browsers so I know it to be working (Windows only - at this time I dont have access to Mac and I will get around to running a flavour or Linux when I find my ram disk).

This is a safari issue!

Tested and Confirmed working;
IE6, IE7, IE8[Beta], FF2, FF3[Beta], Opera, Netscape, Avant, Flock.

Tested and failed in;
Safari
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
  #2 (permalink)  
Old 04-01-08, 02:25 AM
Vicious's Avatar
Vicious Vicious is offline
Community VIP
 
Join Date: Jan 2007
Location: Belgium
Posts: 584
Thanks: 0
Thanked 0 Times in 0 Posts
Do you mind posting your code that changes the zIndex anyway?
__________________
Jack Bauer makes Chuck Norris cry
Reply With Quote
  #3 (permalink)  
Old 04-01-08, 05:11 AM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
I knew someone would ask!

javascript Code:
  1. function SendTo(id,Send)
  2. {
  3.     var Element = document.getElementById(id);
  4.    
  5.     if(Send == "up"){
  6.     var LayerIndex = Element.style.zIndex;
  7.     LayerIndex++;
  8.     }
  9.    
  10.     if(Send == "down"){
  11.     var LayerIndex = Element.style.zIndex;
  12.     LayerIndex = LayerIndex - 1;
  13.     }      
  14.    
  15.         Element.style.zIndex = LayerIndex;
  16. }


HTML Code:
<div id="Menu">
  <img src="bringforward.jpg" onclick="SendTo('picture1','up')" />
  <img src="sendback.jpg" onclick="SendTo('picture1','down')" />
</div>
<div id="picture1">IMG</div>
<div id="picture2">IMG</div>

<!-- CSS sets these two divs to absolute (I need absolute layering) with a size of 200x200px with border and background colour with a z-index of;
picture 1 = z-index 1
picture 2 = z-index 2
These two sit inside another absolute div layer which has a z-index of 0-->
You will notice that I use a very strange way of decreasing as far as C++ programmers are concerned "LayerIndex = LayerIndex - 1;" I needed to write it like this because the W3C validator came across "LayerIndex --;" and highlighted the "--" as a bad comment! ...go figure?!

No matter how much I click the bringforward or sendback the layering doesnt change in safari. If I click the bringforward on picture1 ten times then the z-index of this should be 11.

Thanks
Dal.
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."

Last edited by Nico; 04-01-08 at 09:32 AM.
Reply With Quote
  #4 (permalink)  
Old 04-01-08, 06:28 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by DAL View Post
No matter how much I click the bringforward or sendback the layering doesnt change in safari. If I click the bringforward on picture1 ten times then the z-index of this should be 11.
I don't know about anyone else, but I've had loads of issues with Javascript in Safari. Some things just don't work at all, some things produce errors, and a few things actually produce incorrect answers (date handling, mostly). And this is code that works properly in every other browser on the planet as near as I can tell. I've more or less given up on trying to make a lot of javascript stuff work in Safari.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #5 (permalink)  
Old 04-01-08, 08:14 AM
Vicious's Avatar
Vicious Vicious is offline
Community VIP
 
Join Date: Jan 2007
Location: Belgium
Posts: 584
Thanks: 0
Thanked 0 Times in 0 Posts
have you tried this:

- alert the z-index after you changed it? Is it what you expect it to be ?
- have you tried putting z-index in the inline style of both divs. Does it work then ?
__________________
Jack Bauer makes Chuck Norris cry
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing iframe src property not working in Safari AmberLR JavaScript 1 04-08-09 10:41 AM
Testing apges on Safari greymoose HTML/XHTML/XML 2 11-17-06 03:21 PM
SAFARI iframe scrollbar help chicagobob HTML/XHTML/XML 0 02-09-06 03:05 PM
exeCommand("Refresh") in Safari shermski JavaScript 1 07-16-05 01:44 AM
Safari Popups ornoc JavaScript 1 03-02-04 11:33 AM


All times are GMT -5. The time now is 11:37 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.