JavaScript embeded in another page
1 posts in topic
Flat View  Flat View

Posted By:   Michael_Lowden
Posted On:   Monday, February 18, 2008 03:20 PM

Hello All,

I'm trying to figure out how to get AJAX to respect the JavaScript (tags) on the page that it is loading. I'm doing basic .innerHtml=AJAXGET() type stuff. pretty simple, and it just ignore the SCRIPT tags that are ported.

anything that is triggered is fine as long as the parent window holds the source code (either directly or imported JS file). So OnClick still works for things like form validation, but ideally i'd like to put this stuff in the sub-page, not in the top level page.

Thanks in advance,

Michael Lowden

Re: JavaScript embeded in another page

Posted By:   Stephen_McConnell  
Posted On:   Tuesday, February 19, 2008 05:36 PM

Once in an chapter on Optimizing Web Applications, I read a suggestion that we put our Javascript at the bottom of the HTML, since if you are doing any DOM access, the Javascript can't access it until the HTML has loaded. And when loading the page, the some browsers will parse the Javascript before loading and rendering the HTML if it is at the top.

I tried it and it worked in Firefox, Opera and Safari, but didn't in IE... So much for consistency and optimizing page loading.

I found that unless I put the javascript at the top, sometimes my functions were not found. It has to do with how IE loads and recognizes the pages. Maybe that's what's happening when you place the Javascript in your "sub-page".

Sometimes, you just can't get there from here.

Stephen McConnell

About | Sitemap | Contact