Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tominated

macrumors 68000
Original poster
Jul 7, 2006
1,723
0
Queensland, Australia
OK, I am a complete n00b at JS, but I hacked up a script for the new version of Tominated Software for the menus and for a safari png thing, but when the script is put into use in IE, the page displays nothing but the background. here is the code:
Code:
var is_Safari = navigator.appCodeName=="Mozilla";

if (is_Safari)
{
	document.write('<style type="text/css">');
	document.write('#nav {background: rgba(255,255,255,.4);}');
	document.write('</style>');
}


var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
	{
	    // Set the length of the timer, in seconds
	    secs = 6
	    StopTheClock()
	    StartTheTimer()
	}

function StopTheClock()
	{
	    if(timerRunning)
	        clearTimeout(timerID)
	    timerRunning = false
	}

function StartTheTimer()
	{
	    if (secs==0)
	    {
	        StopTheClock()
	        // Here's where you put something useful that's
	        // supposed to happen after the allotted time.
	        // For example, you could display a message:
	        document.getElementById('software').style.display = 'none'
			document.getElementById('design').style.display = 'none'
	    }
	    else
	    {
	        secs = secs - 1
	        timerRunning = true
	        timerID = self.setTimeout("StartTheTimer()", delay)
	    }
	}
	
	
function toggleSubmenu( menuID, otherMenuID )
	{
		var menuToOpen = document.getElementById( menuID )
		var otherMenu = document.getElementById( otherMenuID )
		InitializeTimer()
		if( otherMenu.style.display == 'none' )
			{
					menuToOpen.style.display = 'block'
			}
		else
			{
				otherMenu.style.display = 'none'
				menuToOpen.style.display = 'block'
			}
	}
I have no Idea why safarari will take that code name but not WebKit or safari, but it works. What do you think causes the problem in IE?
Thanks in advance
 
First question:

Why are you looking for a browser to report itself as Mozilla, if you're really looking for Safari? Or does Safari report itself as a Mozilla browser?

Second, can you please put the html code of the page you're putting? Because if the browser reports itself as a non-Mozilla browser, you don't have an else statement to deal with this.
 
First question:

Why are you looking for a browser to report itself as Mozilla, if you're really looking for Safari? Or does Safari report itself as a Mozilla browser?

Second, can you please put the html code of the page you're putting? Because if the browser reports itself as a non-Mozilla browser, you don't have an else statement to deal with this.

I was checking in apple's docs and it said safari reports itself as mozilla. here is the html:
Code:
<script type="text/javascript" src="javascript/javascript.js" />
do you think that maybe the fact that I have only the one tag finished like an img is the problem? BTW: why do I need an else statement? if it is another browser it can just keep on doing it's thing.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.