var dockhtml = "";var Dock;var apple = false; window addEvent('load' function() {for(var i = 0; i < dockapps length; i++){if(dockapps[i] != 'Finder' && dockapps[i] != 'Dashboard'){dockhtml += "<img src=\"./Applications/"+dockapps[i]+"/Contents/Resources/icon png\" alt=\""+dockapps[i]+"\" />";}else if(dockapps[i] == "Finder"){dockhtml += "<img src=\"./System/CoreServices/"+dockapps[i]+"/Contents/Resources/icon png\" alt=\""+dockapps[i]+"\" />";}else{dockhtml += "<img src=\"./System/CoreServices/Dock/Contents/Resources/Dashboard png\" alt=\""+dockapps[i]+"\" />";}}$('dock') setHTML(dockhtml);var Dock = new MOSXDock($('dock'));var System = new MOSXSystem();var Desktop = new MOSXDesktop(winWallpaper iconSize); $('apple') addEvent('click' function() {this setProperty('src'. "./System/CoreServices/Finder/Contents/Resources/menu/appleselected png");var apple = true;} bind($('apple'))); $('spotlight') addEvent('click' function() {this setProperty('src'. "./System/CoreServices/Finder/Contents/Resources/menu/spotlightselected png");var spotlight = true;} bind($('spotlight'))); document addEvent('click' function(event) {if(apple == true){$('apple') setProperty('src'. "./System/CoreServices/Finder/Contents/Resources/menu/apple png");var apple = false;alert(apple);}if(spotlight == true){$('spotlight') setProperty('src'. "./System/CoreServices/Finder/Contents/Resources/menu/spotlight png");var spotlight = false;alert(spotlight);}});});
<html><head><title>Mac OS X</title><script><!--var winWallpaper = "Panther_Aqua_Blue_1024x640 jpg";var dockapps = new Array("Finder". "Dashboard". "iTunes". "iPhoto");var winHeight = 640;var winWidth = 1024;var iconSize = 32;--></script><link href="./System/CoreServices/Finder/Contents/MacOS/macosx css" rel="stylesheet" type="text/css" /><script src="./System/CoreServices/Finder/Contents/MacOS/mootools js"></script><!-- <script src="./System/CoreServices/Finder/Contents/MacOS/core/dropdown js"></script> --><script src="./System/CoreServices/Dock/Contents/MacOS/dock js"></script><script src="./System/CoreServices/Finder/Contents/MacOS/desktop js"></script><script src="./System/CoreServices/Finder/Contents/MacOS/system js"></script><script src="./System/CoreServices/Finder/Contents/MacOS/core js"></script></head><body id="body"><div id="menubar"><span id="float"><img src="./System/CoreServices/Finder/Contents/Resources/menu/soundwifi png" alt="Sound and Wifi" /><img src="./System/CoreServices/Finder/Contents/Resources/menu/spotlight png" alt="Spotlight" id="spotlight" /><img src="./System/CoreServices/Finder/Contents/Resources/menubarr png" /></span><span id="left"></span><img src="./System/CoreServices/Finder/Contents/Resources/menu/apple png" alt="Apple" id="apple" /><span id="app" class="text">Finder</span><span class="text">File</span><span class="text">Edit</span><span class="text">View</span><span class="text">Go</span><span class="text">Window</span><span class="text">Help</span></div><div id="desktop"><div id="hd" class="icon"><img src="./System/CoreServices/CoreTypes/harddrive png" alt="Hard Drive" /><br />Macintosh HD</div><div id="whd" class="icon"><img src="./System/CoreServices/CoreTypes/harddrivewindows png" alt="Windows Hard Drive" /><br />WINDOWS</div></div><div id="dockcontain"><div id="dock"></div></div></body></html>
There must be something wrong with your function because I tried these and they all worked with me in Firefox:
window addEvent('click',function(e){new Event(e) stop();alert("click");}); document body addEvent('click',function(e){new Event(e) stop();alert("click");}); document addEvent('click',function(e){new Event(e) stop();alert("click");});
I think it's because 'apple' and 'spotlight' are not defined. Yes you did set apple to false at the beginning but not spotlight and then when you set them to true in the other functions you wrote 'var' so you define new variables that are local to those function they don't use the existing global variables. I guess
Forex Groups - Tips on Trading
Related article:
http://forum.mootools.net/viewtopic.php?pid=33361#33361
comments | Add comment | Report as Spam
|