radar Posted July 30, 2010 Share Posted July 30, 2010 Alright so I have an error with my ajax.js file. which atm doesn't include any real ajax. but im getting an error. var headID = document.getElementsByTagName("head")[0]; loadScript('http://www.thesite.com/site/inc/js/tab.js', headID, 'text/javascript', 'script'); loadScript('http://www.the.com/site/inc/js/prototype.js', headID, 'text/javascript', 'script'); function loadScript(srcs, id, type, element) { var tabScript = document.createElement(element); tabScript.type = 'text/javascript'; tabScript.src = srcs; id.appendChild(tabScript); tabScript.onload=alertArgument(srcs+' is loaded'); } function UpdateEditorFormValue() { // FUNCTION TO ALLOW FCKEDITOR TO RUN WITH AJAX. for ( i = 0; i < parent.frames.length; ++i ) if ( parent.frames[i].FCK ) parent.frames[i].FCK.UpdateLinkedField(); } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } // attach an event properly function attachEvent(element, type, event) { if(element.attachEvent) { element.attachEvent('on' + type, event); } else { element.addEventListener(type, event, false); } } function alertArgument(myString) { alert(myString); } function attachBehaviors() { attachEvent($('clickme'), "click", function() { new Ajax.Updater($('updateme'), 'ajax.html', { method:'get', onComplete:function() { alertArgument('You clicked that thing!') } }) }); } // addLoadEvent(attachBehaviors); its telling me the error is on line 36, which is element.addEventListener(type, event, false); however, when i remove the lines at the very top of this file to dynamically include protoype.js and tab.js it doesn't throw any errors... any clue as to why? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.