Results 1 to 3 of 3

Thread: Scrollable Iframe JavaScript problem

  1. #1
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Scrollable Iframe JavaScript problem

    1) Script Title: Scrollable IFRAME

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ramescroll.htm

    3) Website with problem: http://www.callus.cc/v2

    3) Describe problem: My problem is that the following JavaScript ...

    Code:
    <script language="JavaScript1.2">
    
    //Scrollable content III- By http://www.dynamicdrive.com
    
    var speed, currentpos=curpos1=0,alt=1,curpos2=-1
    
    function initialize(){
    if (window.parent.scrollspeed!=0){
    speed=window.parent.scrollspeed
    scrollwindow()
    }
    }
    
    function scrollwindow(){
    temp=(document.all)? document.body.scrollTop : window.pageYOffset
    alt=(alt==0)? 1 : 0
    if (alt==0)
    curpos1=temp
    else
    curpos2=temp
    
    window.scrollBy(0,speed)
    }
    
    setInterval("initialize()",10)
    
    </script>
    ... does't like to be on the same page as my PHP script. In the installation instructions it says "Insert the below script in the page being loaded in the iframe, at the very end of the document source", which for me happens to be dynamic PHP.

    It works perfectly in Firefox but I get an error in IE saying "Error: Object required.". Sometimes it does actually work in IE, it kinda chooses to work when it wants to.

    Maybe someone could update the JavaScript for me? Thanks!

  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

    Your page has no body and you've not inserted the script at the end as instructed. You might be able to get away with changing:

    Code:
    setInterval("initialize()",10)
    to:

    Code:
    onload=function(){setInterval("initialize()",10)}
    But, you may need to have a body tag (and maybe even html and head tags as well, body tag only shown below):

    Code:
    <body>
    	<table width="100&#37;" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td height="5" colspan="2"></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td width="816" valign="bottom"><span class="style2"><strong>Whooooooooow!</strong></span></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td class="style3">Mother****ing testing baby, I am your father you sausage jocky!</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td></td>
            </tr>
          </table>
    </body>
    And place all of your content in it, keep style in the head.
    - John
    ________________________

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

  3. #3
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your help. But the problem was because the external page was an index.php with only this code ...

    Code:
    <?
    include_once("gigs.php");
    gigs();
    ?>
    ... I was putting the JavaScript in the gigs.php file instead of the index.php. Everthing seems to be fine and dandy now.

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
  •