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? Link to comment https://forums.phpfreaks.com/topic/209384-error-object-doesnt-support-property-or-method/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.