Results 1 to 3 of 3
  1. #1
    Kush
    Guest
    Unhappy Javascript Show/Hide in Safari
    Hi, I'm having trouble with the following JS in Safari:

    Code:
    function showhide(layer_ref,page,image_id,showhide) {
    if (page=='comments') { 
    	document.all.rightiframe.src='commentsframe.php?image_id=' + image_id;
    }
    if (page=='shoutbox') { 
    	document.all.rightiframe.src='shoutboxframe.php';
    }
    
    if (showhide == 'yes') {
    	if (state == 'visible') {
    		state = 'hidden';
    	}
    	else {
    		state = 'visible';
    	}
    	if (document.all) { //IS IE 4 or 5 (or 6 beta)
    	alert("1");
    	eval( "document.all." + layer_ref + ".style.visibility = state");
    	}
    	if (document.layers) { //IS NETSCAPE 4 or below
    	alert("2");
    	document.layers[layer_ref].visibility = state;
    	}
    	if (document.getElementById && !document.all) {
    	alert("3");
    	maxwell_smart = document.getElementById(layer_ref);
    	maxwell_smart.style.visibility = state;
    	}
    }
    }
    Not being a big Javascript user, I can't understand why this doesn't work in Safari? You can see the alerts I've put in... well none of them show up, so I've identified where my problems begin at least!

    I've tested it on IE, Firefox and Opera for PC and it works no problem.

    Any ideas? :dive:

  2. #2

    Murlyn's Avatar
    Member Since
    Jun 11, 2003
    Location
    Mount Vernon, WA
    Posts
    4,915
    Specs:
    MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
    Try changing state = 'visible' to state = '';
    That might work for you.

  3. #3
    Kush
    Guest
    further investigation
    I've been looking into this a bit more today and it looks like the following line causes the script to stop functioning:
    Code:
    document.all.rightiframe.src='shoutboxframe.php';
    Anyonw know why Safari would choke on this?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mavericks hide/show bug ?
    By Zewert in forum OS X - Operating System
    Replies: 1
    Last Post: 01-14-2015, 08:46 AM
  2. How can I hide/show icons in the menu bar?
    By akurtula in forum Switcher Hangout
    Replies: 0
    Last Post: 09-13-2011, 06:19 PM
  3. Safari Javascript Help
    By bluecollar01 in forum Web Design and Hosting
    Replies: 0
    Last Post: 04-12-2011, 10:13 AM
  4. Dock hide-show lag
    By imme in forum Switcher Hangout
    Replies: 2
    Last Post: 03-25-2008, 01:07 PM
  5. How do I get my dock to stay on show (not hide)
    By MacPhotoPro503 in forum Apple Notebooks
    Replies: 2
    Last Post: 10-02-2006, 03:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •