New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Web Design and Hosting Creating sites, scripting, and hosting discussions.

Javascript Show/Hide in Safari

Post Reply New Thread Subscribe

Thread Tools
Posts: n/a

Hi, I'm having trouble with the following JS in Safari:

function showhide(layer_ref,page,image_id,showhide) {
if (page=='comments') { 
	document.all.rightiframe.src='commentsframe.php?image_id=' + image_id;
if (page=='shoutbox') { 

if (showhide == 'yes') {
	if (state == 'visible') {
		state = 'hidden';
	else {
		state = 'visible';
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
	eval( "document.all." + layer_ref + ".style.visibility = state");
	if (document.layers) { //IS NETSCAPE 4 or below
	document.layers[layer_ref].visibility = state;
	if (document.getElementById && !document.all) {
	maxwell_smart = document.getElementById(layer_ref); = 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:
QUOTE Thanks

Murlyn's Avatar
Member Since: Jun 11, 2003
Location: Mount Vernon, WA
Posts: 4,914
Murlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to all
Mac Specs: MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2

Murlyn is offline
Try changing state = 'visible' to state = '';
That might work for you.
QUOTE Thanks
Posts: n/a

I've been looking into this a bit more today and it looks like the following line causes the script to stop functioning:
Anyonw know why Safari would choke on this?
QUOTE Thanks

Post Reply New Thread Subscribe

« Web Question... I have a site and domain name... no hosting... I dontunderstand... | Offer for M-F Members only »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
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 Off
Forum Jump

Similar Threads
Thread Starter
Last Post
How do I debug javascript in Safari? Srikanth.S Web Design and Hosting 3 08-05-2005 11:40 AM
Safari is the browser to use on OS X!! Computer.Geek OS X - Apps and Games 14 04-29-2005 03:01 PM
Javascript and Safari (earlier versions) noodles Web Design and Hosting 0 02-17-2005 02:46 PM
Javascript and Frames problem in Safari HarrySpier Web Design and Hosting 3 11-09-2004 04:47 PM
Safari Javascript problem babszem Web Design and Hosting 0 02-26-2004 03:21 PM

All times are GMT -4. The time now is 11:46 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?