Results 1 to 3 of 3

Thread: Dynamic Ajax Content and page javascript

  1. #1
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Dynamic Ajax Content and page javascript

    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    This is in reference to the dynamic ajax content script.


    Hi,

    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.

    Code:
    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';
            }
        }
    }
    Thanks,
    Deon

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    <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:

    Code:
    select_all_radio_in(elTagName, elClass, elId)

  3. #3
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    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!

    Thanks for the help!

    Deon

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •