JavaScript - Joomla 1.7 And Javascript
Guys,
have you had any "positive" experiences with embedding Javascript into joomla 1.7? Is this even possible? Regards, Sam Blythe, @ blanket holder Similar TutorialsHi, my website name is marutiindia.in. I am using lof k2 scroller module along with image magnifier plugin developed by Vtem. The problem is I get JS error in scroller module JS file when I try to enable both these extensions at the same time. If I disable image magnifier plugin there is no error. I don't know what are these errors but I get the following error: Code: Uncaught TypeError: Object #<Object> has no method 'getElement' Class.initialize script_12.js:27 (anonymous function) mootools-more.js:29 i.extend.$owner mootools-core.js:136 (anonymous function) mootools-core.js:131 (anonymous function) Please help me. Thanks. Hello, i am a total newbie, so forgive me i have the following problem: a Joomla Gallery uses a javascript to show fullsize images. but when the popup windows comes out, it doesn't have any properties (page title, url about:blank, blank background etc) here is a screenshot: I think the following to be the code that calls the popup: what's wrong? NOTE I already had to remove some "spaces" from the code because the Joomla SEF was changing the urls forbidding the right execution of everything, maybe it's something like that... dunno :cry: Code: $htmltext2 .= "<script language=\"JavaScript\">"; $htmltext2 .= "function pgpopup(pgimagefile,pgimagetitle,pgimagedescription) {\n"; $htmltext2 .= "var newWindow = window.open(\"\",\"newWindow\",\"height=" . ($tabparams["pgmaxheight"]+$dparm[2]) . ",width=" . ($tabparams["pgmaxwidth"]+$dparm[3]) . ",resizable=yes, scrollbars=yes, toolbar=no " . "\" );\n"; $htmltext2 .= "var imageurl = \"<img src= \"+ pgimagefile + \">\";\n"; $htmltext2 .= "newWindow.document.open();"; $htmltext2 .= "newWindow.document.writeln(\"<div align='center' >\");\n"; $htmltext2 .= "newWindow.document.writeln(\"<title>Profile Gallery Image: \"+ pgimagetitle + \"</title>\");\n"; $htmltext2 .= "newWindow.document.writeln(imageurl);\n"; $htmltext2 .= "newWindow.document.writeln(\"<br />\");"; $htmltext2 .= "newWindow.document.writeln(pgimagedescription);\n"; $htmltext2 .= "newWindow.document.writeln(\"</div>\");\n"; $htmltext2 .= "newWindow.document.close();\n"; $htmltext2 .= "}\n"; $htmltext2 .= "</script>"; break; anyone can help? thanks! Hi friends, Am customizing a Joomla website and i need to know how to get a nice and fine javascript accordion horizontal panel which is so smooth and good looking to add in Joomla Home page. Please suggest me some horizontal javascript accordion with images and link to another page. Thanks in Advance. Hi everyone, Im new to the whole website thing as a whole but my mate got me onto joomla which has been great and iv got a site up im almost happy with and have learnt quite alot about coding etc. My problem is: Im utilising a vertical menu, just simple text as links, i want to add an effect on hover and clicking on that makes the text slide elegantly to the right about 16pixels. I have another unpublished template that iv bought (that doesnt quite work at all, module position all messed up etc) but it does this hover effect perfectly on the menu. So i have the .js file from that template and iv read some tutorials on how to add a js file to my template but its just not doing anything. Is it a good idea to try to add this file from a different template to my template or is there a easier way to do this (what i think is a) simple effect. Thanks. ps i can post the js code if wanted In Joomla I want to create a form that posts values. Of the fields I have a dropdown box, but when a checkbox for "other" is clicked I want a textbox to show. How to I show/hide and post the select box's value or the textbox's value depending on whether the checkbox is checked (along with the other values on the form)? Thanks much for any help. Using Joomla 1.5.26, I'm trying to have Diigo bookmarks show up in an article. Diigo has an API that will fetch the bookmarks and return them in a JSON format. For these bookmarks to be updated, I suppose the page would need to be refreshed; it's not like a Twitter real-time feed... Example API call to: https://secure.diigo.com/api/v2/book...itman&count=10 Here's what's returned: [{"updated_at":"2012/05/14 19:04:31 +0000","url":"http://etc.fdresa.org/index.php?option=com_content&%3Bview=article&%3Bid=93%3A2012-summer-technology-offerings&%3Bcatid=42%3A2012-courses&%3BItemid=2#.T7FW-LgvBMw.diigo","annotations":[],"user":"dritman","readlater":"no","shared":"yes","tags":"etc,technology,courses","created_at":"2 012/05/14 19:04:31 +0000","title":"2012 Summer Technology Offerings","comments":[],"desc":""},{"updated_at":"2012/05/11 16:51:38 +0000","url":"http://etc.fdresa.org/index.php?option=com_content&%3Bview=article&%3Bid=94%3Alive-feeds&%3Bcatid=43%3Alinks&%3BItemid=50#.T61DemaIB_w.diigo","annotations":[],"user":"dritman","readlater":"no","shared":"yes","tags":"no_tag","created_at":"2012/05/11 16:51:38 +0000","title":"Live feeds","comments":[],"desc":"Testing"}] How do I go about parsing this JSON info into a readable format within a Joomla article? Thanks! Hello I'm having trouble with ignitegallery in Joomla. I installed it and created a gallery, but it doesn't seem to work properly. The image doesn't load, only the thumbnails. And in firebug, it says this: $(this.options.largeImage).getElement is not a function - what does that mean? Here's the link to the gallery: http://saintella.com/index.php?optio...id=1&Itemid=6# Thanks for any help in advance. I am getting error when using the script below in vm mynxx template by rockettheme in virtuemart Joomla 1.5 - It works fine outside of mynxx User inputs data into a html form- presses "Get Price" button and a price is returned to same form. Problem is that user is unable to submit to cart firebug error - callback is not a function callback(this.responseText); my ajax script Code: function Ajax() { this.instance = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); this.request = function(url, callback) { this.instance.open('GET', url, true); this.instance.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { callback(this.responseText); } } this.instance.send(null); } } function validate(form) { (new Ajax).request('testform.php?width65=' + form.width65.value + '&length65=' + form.length65.value, function(respons) { var prices = eval(respons); form.price.value = prices[0]; form.otherprice.value = prices[1]; }); } I think I have tracked the file down to theme.js and require some code to validate the function. I am new at this and this is way above me - any help would be appreciated Theme.js code - was packed - ie eval(function(p,a,c,k,e,r){e=function(c)...... I have unpacked it Code: var RokVM = {}; RokVM.autoHide = 3; // seconds before auto closing the Panel RokVM.Base= { uri:window.templatePath,start:function() { RokVM.Base.quantityBox(); RokVM.Cart.init() } ,featuredHeight:function(b) { b=$(b); if(!b) { return RokVM.Base } var c=b.getElements(".home-featured-inner"); var d=0; c.each(function(a) { d=Math.max(a.getSize().size.y,d) } ); c.setStyle("height",d) } ,quantityBox:function() { var h=$$(".cart-quantity-box, .home-featured-cartblock"); if(h.length) { h.each(function(b) { var c=b.getElement(".quantity_box_button_up"); var d=b.getElement(".quantity_box_button_down"); var f=b.getElement(".inputboxquantity"); if(!c||!d||!f) { return } var g=f.getValue().toInt(); f.addEvent("keyup",function(e) { e=(new Event(e)).stop(); var a=this.value; if(a<0) { a=0 } if(isNaN(a)) { this.value=1; a=1 } if(e.key=="up") { if($type(this.getValue().toInt())=="number") { this.value=++a } } if(e.key=="down") { if(a>0&&$type(this.getValue().toInt())=="number") { this.value=--a } } } ); f.addEvent("mousewheel",function(e) { e=(new Event(e)).stop(); var a=this.value; if(a<0) { a=0 } if(isNaN(a)) { this.value=1; a=1 } if(e.wheel==1) { if($type(this.getValue().toInt())=="number") { this.value=++a } } if(e.wheel==-1) { if(a>0&&$type(this.getValue().toInt())=="number") { this.value=--a } } } ); c.addEvent("click",function(e) { (new Event(e)).stop(); if($type(f.getValue().toInt())=="number") { f.value=++f.value } } ); d.addEvent("click",function(e) { (new Event(e)).stop(); if(f.getValue().toInt()>0&&$type(f.getValue().toInt())=="number") { f.value=--f.value } } ) } ) } } }; RokVM.Cart= { init:function() { RokVM.Cart.cartPanel=$("cart-panel"); RokVM.Cart.cartButton=$("cart-button"); RokVM.Cart.cartSurround=$("cart-panel-surround"); if(!RokVM.Cart.cartPanel||!RokVM.Cart.cartButton||!RokVM.Cart.cartSurround) { return RokVM.Cart } if(!RokVM.Cart.Fx) { RokVM.Cart.Fx=(new(Fx.Slide)(RokVM.Cart.cartPanel, { duration:400,transition:Fx.Transitions.Expo.easeOut } )).hide() } RokVM.Cart.cartSurround.setStyle("visibility","visible"); RokVM.Cart.cartButton.getFirst("a").addEvent("click",function(e) { (new Event(e)).stop(); if(!RokVM.Cart.cartPanel.getText().length&&!window.webkit) { return } if(!RokVM.Cart.cartPanel.innerHTML.clean().length&&window.webkit) { return } var a=RokVM.Cart.cartButton.getElement("strong"); if(!a||!a.getText().toInt()&&(!RokVM.Cart.cartPanel.getText().length&&!window.webkit)) { return } RokVM.Cart.clicked=true; if(window.fontFx&&window.fontFx.open) { window.fontFx.toggle() } if(window.loginFx&&window.loginFx.open) { window.loginFx.toggle() } RokVM.Cart.Fx.toggle() } ); RokVM.scrollWindow=new(Fx.Scroll)(window); RokVM.Cart.getShortList(); RokVM.Cart.XHRify() } ,XHRify:function() { var b=$$(".addtocart_form"); if(!b.length) { return RokVM.Cart } b.each(function(a) { a.addEvent("submit",RokVM.Cart.add.bindWithEvent(a,true)) } ) } ,add:function(e,c) { (new Event(e)).stop(); (new Ajax(this.getProperty("action"), { data:$(this),evalScripts:true,onComplete:function(r) { var a=new Element('div').setHTML(r); var b=a.getElement('.shop_tip'); RokVM.Cart.getShortList((r.length&&b)?r:false); RokVM.Cart.clicked=c||false } } )).request() } ,getShortList:function(b) { var c= { onComplete:function(a) { RokVM.Cart.update(a,b) } ,evalScripts:true,data: { only_page:1,page:"shop.basket_short",option:"com_virtuemart" } }; (new Ajax(RokVM.Base.uri+"index2.php",c)).request() } ,handleError:function(a) { var b=RokVM.Cart.cartPanel; var c=new Element('div').setHTML(a); var d=b.getElement('.show-cart-button'); var e=c.getElement('.shop_tip').inject((d)?d:b,(d)?'before':'inside') } ,update:function(a,b) { RokVM.Cart.cartPanel.setHTML(a); var c=RokVM.Cart.cartPanel.getElement(".total_products"),total=0; if(c) { total=c.innerHTML.split(" ")[0].toInt() } if(!total) { RokVM.Cart.cartButton.getFirst().setProperty("class","cart-button-desc") } else { RokVM.Cart.cartButton.getFirst().setProperty("class","cart-button-desc-full") } RokVM.Cart.cartButton.getElement("strong").setText(total); if(b)RokVM.Cart.handleError(b); if(RokVM.Cart.clicked&&a.length||b) { if(window.fontFx&&window.fontFx.open) { window.fontFx.toggle() } if(window.loginFx&&window.loginFx.open) { window.loginFx.toggle() } RokVM.scrollWindow.toTop(); RokVM.Cart.show(); RokVM.Cart.hide.delay(RokVM.autoHide*1000) } RokVM.Cart.clicked=false } ,show:function() { RokVM.Cart.Fx.slideIn() } ,hide:function() { RokVM.Cart.Fx.slideOut() } }; window.addEvent("domready",RokVM.Base.start); window.addEvent(window.webkit?"load":"domready",function() { RokVM.Base.featuredHeight("home-featured") } ); var live_site = RokVM.Base.uri; Then following - this in the same theme.js file (this is not packed) Code: /// Following is VM stuff, kept for compatibility /** * This file holds javscript functions that are used by the templates in the Theme * */ // AJAX FUNCTIONS function loadNewPage( el, url ) { var theEl = $(el); var callback = { success : function(responseText) { theEl.innerHTML = responseText; if( Lightbox ) Lightbox.init(); } } var opt = { // Use POST method: 'get', // Handle successful response onComplete: callback.success } new Ajax( url + '&only_page=1', opt ).request(); } function handleGoToCart() { document.location = live_site + '/index.php?option=com_virtuemart&page=shop.cart&product_id=' + formCartAdd.product_id.value ; } function handleAddToCart( formId, parameters ) { formCartAdd = document.getElementById( formId ); var callback = function(responseText) { updateMiniCarts(); // close an existing mooPrompt box first, before attempting to create a new one (thanks wellsie!) /*if (document.boxB) { document.boxB.close(); clearTimeout(timeoutID); } document.boxB = new MooPrompt(notice_lbl, responseText, { buttons: 2, width:400, height:150, overlay: false, button1: ok_lbl, button2: cart_title, onButton2: handleGoToCart }); setTimeout( 'document.boxB.close()', 3000 );*/ } var opt = { // Use POST method: 'post', // Send this lovely data data: $(formId), // Handle successful response onComplete: callback, evalScripts: true } new Ajax(formCartAdd.action, opt).request(); } /** * This function searches for all elements with the class name "vmCartModule" and * updates them with the contents of the page "shop.basket_short" after a cart modification event */ function updateMiniCarts() { var callbackCart = function(responseText) { carts = $$( '.vmCartModule' ); if( carts ) { try { for (var i=0; i<carts.length; i++){ carts[i].innerHTML = responseText; try { color = carts[i].getStyle( 'color' ); bgcolor = carts[i].getStyle( 'background-color' ); if( bgcolor == 'transparent' ) { // If the current element has no background color, it is transparent. // We can't make a highlight without knowing about the real background color, // so let's loop up to the next parent that has a BG Color parent = carts[i].getParent(); while( parent && bgcolor == 'transparent' ) { bgcolor = parent.getStyle( 'background-color' ); parent = parent.getParent(); } } var fxc = new Fx.Style(carts[i], 'color', {duration: 1000}); var fxbgc = new Fx.Style(carts[i], 'background-color', {duration: 1000}); fxc.start( '#222', color ); fxbgc.start( '#fff68f', bgcolor ); if( parent ) { setTimeout( "carts[" + i + "].setStyle( 'background-color', 'transparent' )", 1000 ); } } catch(e) {} } } catch(e) {} } } var option = { method: 'post', onComplete: callbackCart, data: { only_page:1,page: "shop.basket_short", option: "com_virtuemart" } } new Ajax( live_site + '/index2.php', option).request(); } /** * This function allows you to present contents of a URL in a really nice stylish dhtml Window * It uses the WindowJS, so make sure you have called * vmCommonHTML::loadWindowsJS(); * before */ function fancyPop( url, parameters ) { parameters = parameters || {}; popTitle = parameters.title || ''; popWidth = parameters.width || 700; popHeight = parameters.height || 600; popModal = parameters.modal || false; window_id = new Window('window_id', {className: "mac_os_x", title: popTitle, showEffect: Element.show, hideEffect: Element.hide, width: popWidth, height: popHeight}); window_id.setAjaxContent( url, {evalScripts:true}, true, popModal ); window_id.setCookie('window_size'); window_id.setDestroyOnClose(); } Hello there. I'm using Joomla 1.5 and VirtueMart for my e-shop. I've also installed a virtuemart template which loads mootools. Well in my virtuemart product detail pages, if you click the main image to make it enlarged using IE8 it will not open and return a JS error instead (found it using Firebug): http://goo.gl/6lQCV Code: Message: 'closeButton' is null or not an object Line: 21 Char: 63 Code: 0 URI: http://www.xxxxx.xxx/media/system/js/mootools.js I'm not sure but I think that if I fix the JS errors on these pages the problem will be solved and the images will open normally. Note that on all other browsers it works fine (Firefox, Chrome, Safari, IE9). The page returns some other errors too but they're the whole time there. I think there's a conflict caused by all the JS libraries loaded by my Plugins (System - RokBox & YOOeffects), Joomla template, VirtueMart & VirtueMart template (jquery and mootools are both loaded). Thanks in advance Hello! I am trying to find a script that allows you to open multiple browser tabs and then close each of those tabs, either one by one or all at once. Does anyone know how to do this please? Thanks so much for your help. I want to have another go at Javascript. I have several books on the subject but I find that my eyesight is a major problem. Therefore I want to try an on-line solution, preferably free. I have Googled, but there are so many that I am almost dizzy with the choices. Perhaps someone could recommend one. Not too fussy visually. My knowledge is VERY basic. Frank Does anyone know how to make URL links that use Javascript still work when users have Javascript disabled on their browser? The only reason I'm using JS on a URL is because my link opens a PDF file, and I'm forcing it not to cache so users have the latest version. I tried the <script><noscript> tags, but I'm not sure if I'm using it correctly, as my URL completely disappears. Below is my HTML/Javascript code: <p class="download"> <script type="text/javascript">document.write("<span style=\"text-decoration: underline;\"><a href=\"javascript:void(0);\" onclick=\"window.open( 'http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf?nocache='+ Math.floor( Math.random()*11 ) );\" >The Child Magazines Media Kit</a></span> (PDF 1 MB) ");</script> <noscript><span style="text-decoration: underline;"><a href="http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf" >The Child Magazines Media Kit</a></span> (PDF 1 MB)</noscript> </p> Thanks for any help, Michael Hi, I have the following code snippet: test.html ====== <script language="javascript" type="text/javascript"> var testVariable = "test"; </script> <script language="javascript" type="text/javascript" src="test.js"> </script> test.js ===== var testVariable = window.top.testVariable; In firefox, I'm able to access testvariable defined within test.html in test.js. But in chrome, test.js couldnot get the window.top.testVariable field defined in test.html. Can any one please let me know how i can make it work in chrome?. Am i missing something here?. Hi Guys, I am new at JavaScript and start to do some tutorials.What I am trying to do here is prompting user to input a name and if the name was valid the page(document) will display with all objects like the button.But if user enter a wrong name then the button will be disabled! I create the following code but it did not work <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="JavaScript" type=""> function changeColor(){ document.bgColor = "Gray"; } </script> </head> <body> <script language="JavaScript" type="text/javascript"> var person = ""; person = prompt('What is Your Name:'); if (person == "Foo") { document.write("<h1 />Welcome " + person); document.bgColor = "Yellow"; } else { document.write("<h1 />Access Denied!!!!"); document.bgColor = "Red"; document.getElementById("gree").disabled = true; } </script> <div> <p/><input id="gree" type="button" value="Gray " onClick="changeColor();"> </div> </body> </html> as you can see I used the: document.getElementById("gree").disabled = true; but it did not work , could you please give an idea how I can solve this problem? Thanks I got an index.php Code: <html> <form action="bacakomik.php" method='post'> <select name="kodekomik"> <option value='../komik1/|23'>Judul Komik1</option> <option value="../komik2/|20">Judul Komik2</option> <option value="../komik3/|10">Juduk Komik3</option> <option value="../komik4/|20">Judul Komik4</option> </select> <input type="submit" /> </form> <?php echo ('<select>'); echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); echo ('</select>'); ?> </html> As you can see, each of the option brings specific value "../komik1/|23" komik1 is a directory | is a delimiter 23 is the pages in one chapter and can be considered also as how many images are there on a specific directory This is my bacakomik.php Code: <?php $dirkomik = $_POST['kodekomik']; $exploded = explode("|", $dirkomik); echo ($exploded[0]); //picture directory echo ("<br>"); echo ($exploded[1]); //total page in the comic $pagecount = (int)$exploded[1]; //Take last posted value, process it right away echo ('<FORM name="guideform"> '); echo ('<select name="guidelinks">'); $i=1; do { echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); $i= $i+1; }while($i <= $pagecount); //Printing option and select echo ("</select>"); ?> <input type="button" name="go" value="Go!" onClick="document.getElementById('im').src=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value+'.png';"> </FORM> <img src="img0.jpg" id="im"> With the current code on bacakomik.php, I only can change the img src of id "im" in the same directory only. What I want is that the Javascript could "add" the "$exploded[0]" variable so that the picture can be loaded from different directory. Anyone can do this? I believe that the fix should be somewhere on input tag inside OnClick, or do you know where? Anyway, I found this on the net http://p2p.wrox.com/php-faqs/11606-q...avascript.html Please help me to those who can... Hey, I've got to make the values of some textboxes change the co-ordinates of my sprite on a canvas and havent a clue on how to do it, Here is my form with the two textboxes and submit button: <form> x: <input type="text" name="x" /><br /> y: <input type="text" name:"y" /><br /> <input type="submit" value="Submit"/><br /> </form> And i need it so that they change the values of these: //this shows where my sprite will start on the canvas var block_x; var block_y; searched the internet for hours and cant really find anything i understand or works. any help is much appreciated I want to insert this js snippet Code: function addText(smiley) { document.getElementById('message').value += " " + smiley + " "; document.getElementById('message').focus(); return false; } to a loaded iframe with name&id chtifrm. I can access it & change embed something in its html via using something like: Code: $(parent.chtifrm.document.body).append('<div id=\"smly\" style=\"cursor:pointer;float:left;top:200px;display:none;position:absolute;\"><\/div>'); .... Code: parent.chtifrm.document.getElementById('chatbox_option_disco').style.display == 'none' but how do I insert js in the head of loaded iframe? Hi Guys I am trying to modify the functionality of my page. I want to be able to activate this piece of code using another javascript function. This is the code I want to activate: Code: <script type="text/javascript"><!-- $('#button-cart').bind('click', function() { $.ajax({ url: 'index.php?route=checkout/cart/update', type: 'post', data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea, .date_data input[type=\'text\']'), dataType: 'json', success: function(json) { $('.success, .warning, .attention, information, .error').remove(); if (json['error']) { if (json['error']['warning']) { $('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.warning').fadeIn('slow'); } for (i in json['error']) { $('#option-' + i).after('<span class="error">' + json['error'][i] + '</span>'); } } if (json['success']) { $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.success').fadeIn('slow'); $('#cart_total').html(json['total']); $('html, body').animate({ scrollTop: 0 }, 'slow'); } } }); }); //--></script> And this is how I want the format of the function to be: function testsession() { if there is a session called 'hiredate' { activate the script above } else { var el = document.getElementById("product_data"); } } I just dont know how to write this in javascript Could you help me if possible please All -- I have a JavaScript config file called gameSetting.js which contains a bunch of variables which configures a particular game. I also have a shared JavaScript library which uses the variables in gameSetting.js, which I include like so: <script type="text/javascript" src="gameSetting.js" ></script> <script type="text/javascript" src="gameLibrary.js" ></script> In gameSetting.js I have: $(document).ready(function() { // call some functions / classes in gameLibrary.js } in Firefox, Safari, and Chrome, this works fine. However, in IE, when it's parsing gameSetting.js, it complains that the functions that live in gameLibrary.js aren't defined. When it gets to parsing gameLibrary.js, the variables in gameSetting.js are reported as not being defined. I've tried dynamically bootstrapping the gameLibrary file using this function in document.ready for dynamic load... $.getScript("gameLibrary.js"); However, the same problem still happens in IE, where when it parses the files individually it's not taking into context the file/variables that came before, so it's not an out of load order problem. My options a 1) collapsing all the functions in gameLibrary.js and variables in gameSetting.js into one file. However, this is not practical because this is dealing with literally hundreds of games, and having a gameLibrary.js in ONE location for ONE update is what makes most logical sense. 2) figure out a way to get this to work where variables in file1 are accessible to file2 in IE (as it seems they are in other browsers). jQuery seems to be able to have multiple plugins that all refer to the based jQuery-1.3.2.js, so I know there is a way to get this to work. Help appreciated. Nero I wrote a log function that took note of various function calls. Thinking that functions are first class objects, and objects have properties, I made the name of each logged function a property of that function, e.g., brightenInnerPara.name = "brightenInnerPara"; Every browser I tried (Firefox, MSIE, Opera, Chrome, Safari) accepted the assignment, no problem. In Firefox and MSIE, the result was what I wanted: brightenInnerPara.name == "brightenInnerPara" But in the others, the result was: brightenInnerPara.name == null Question 1. Which Javascript is correct here? I favor Firefox and MSIE, not merely because they were willing to give me what I wanted, but also because it makes no sense to accept an assignment statement without throwing an error and then give it a null semantics, like Chrome, Opera, and Safari did. I found a workaround, using assignments like this: brightenInnerPara.prototype.name = "brightenInnerPara"; To my surprise, that worked in every browser. But I don't know why. It seems that such assignments are enough to cause each function to have its own distinct prototype. Question 2. Just how inefficient is my workaround, and why does it work? |