Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Dynamic Ajax Content with Javascript

  1. #1
    Join Date
    Apr 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic Ajax Content with Javascript

    Script: Dynamic Ajax Content
    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    Hi,

    I'm trying to add a javascript (slideshow) into an external pages
    to see the slide show code http://www.dhteumeuleu.com/runscript...r=diapo-S.html
    click on Voir la source.


    I have made 1 css and 1 js file.

    I used this code:

    <a href="javascript:ajaxpage('files/test.htm', 'rightcolumn'); loadobjs('gallery.css', 'gallery.js')"> test</a>

    into my test.htm I put the code of the slideshow without the javascript
    and I put this code into the head section

    <link rel="stylesheet" href="gallery.css" type="text/css">
    <link rel="text/javascript" href="gallery.js" type="text/js">

    I not sure for the second line... and it's not working...

    thanks for your help

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This:

    Code:
    <link rel="text/javascript" href="gallery.js" type="text/js">
    should be:

    Code:
    <script type="text/javascript" src="gallery.js"></script>
    There could be other problems.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You also need to execute script elements in the external page:
    Code:
    <script type="text/javascript">
    function runScripts(id) {
      var e = document.getElementById(id).getElementsByTagName("script");
      for(var i=0;i<e.length;i++) eval(e[i].innerHTML);
    }
    </script>
    <a href="javascript:ajaxpage('files/test.htm', 'rightcolumn'); loadobjs('gallery.css', 'gallery.js'); runScripts('rightcolumn');"> test</a>
    However, you may still have problems if part of a script needs to be in the head.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Apr 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,
    thanks for your help..

    where into the external page do I need to put this code:
    Code:
        
    <script type="text/javascript">
    function runScripts(id) {
      var e = document.getElementById(id).getElementsByTagName("script");
      for(var i=0;i<e.length;i++) eval(e[i].innerHTML);
    }
    </script>
    cause this not working
    I think maybe there is also a problem with the css..

    Do you have a suggestion for a gallery with no db that will work into
    Dynamic Ajax Content.

    Thanks
    Last edited by lena; 04-22-2006 at 08:13 PM.

  5. #5
    Join Date
    Apr 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You dont put that in the external page, you put it on the main one and in the links you make it run the function.

    And thanks twey.. Just what I came here to post for

    But it doesn't seem to work Any ideas why?

    The link looks like this:
    Code:
    <a onclick="callpage('pages/ch.php', 'content'); runScripts('content');">Something</a>
    and the ch.php looks like this
    Code:
    <head>
    <script src="../scripts/ajax.js" type="text/javascript"></script>
    </head>
    <body onload="gethits('name','');setupimg('up1');">
    <table id="table" cellspacing="0" cellpadding="0" style="width:510px" border="1"> 
    </body>
    Any ideas? :/
    Last edited by jackyyll; 04-23-2006 at 05:42 PM.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    An external Javascript, now, could be more difficult. I'll have a crack at it.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Apr 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It doesnt work when the javascript is inside the same file either :x

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    In that case, I ought to have a look at your page. Can you post a URI?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Apr 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Okay, heres the URL: http://www.monsterwiki.com/jackyyll/index.php

    You have to register to get in but it's real quick. And it's the tab called 'something' that i'm having the problems with.

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Nice site, but after I register, it gives me "Username not found" when I try to log in.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •