View Full Version : Dynamic Ajax Content and page javascript

02-26-2006, 11:20 AM

This is in reference to the dynamic ajax content script.


I posted before and have been playing around with the script and all was going well. Now I have one page that is loading into the div with one javascript function. I tried to pull the function out of the page and into an external javascript file and then try to load that file with the referring page but to no avail. I must be doing something wrong.

Here is the function that is in the page. I know there are some compatability issues with functions and this script from other forum posts I have read. I wouldn't know though :( . Any help is appreciated.

function select_all_radio_in(elTagName, elClass, elId) {
var inputs = document.getElementsByTagName('INPUT');
inputs = filterByParent(inputs, function(el) {return findParentNode(el, elTagName, elClass, elId);});
for(var i = 0; i < inputs.length; ++i) {
if(inputs[i].type == 'radio') {
inputs[i].checked = 'checked';


02-26-2006, 01:01 PM
Firstly, verify that the function above works when you put it directly inside your main page's source. If it does, then move the function to an external .js file, such as "selectall.js", and load it via ajax by doing something like:

<a href="javascript:ajaxpage('test.htm', 'contentarea'); loadobjs(selectall.js')">test</a>

Once it's loaded, note that you'll still need to call the function to invoke it:

select_all_radio_in(elTagName, elClass, elId)

02-26-2006, 01:52 PM
Hey DDadmin,

Thank you for your response. I was doing everything correctly but I was not saving the javascript file in the right folder. I was saving it in the loading pages folder when it should be saved in the referring page folder. Works perfectly! :D

Thanks for the help!