www.webdeveloper.com
Results 1 to 3 of 3

Thread: Help - Scrolling in Javascript

  1. #1
    Join Date
    Apr 2012
    Posts
    1

    Help - Scrolling in Javascript

    Hi - I have this javascript on my page (that is an iframe).

    site_address is a parameter that's passed to the page when loaded.

    <script type="text/javascript">
    var site = 'http://' + 'localParameter("site_address")'
    <!--
    window.location = site
    //-->
    </script>

    Now, I need to make this iframe scroll down by like 50 pixels once the page is loaded. How can I do this?

    I don't much about javascript, html, web development.

    Thanks

  2. #2
    Join Date
    Jan 2012
    Posts
    31
    By scrolling do you mean move? Scrolling is what you do with scroll bars, if you want the element (in this case an iframe) to be in a different spot, its move.

    I only ask as scrolling could be very difficult, if not impossible (I have never had to do it so don't know, would have to look). Where as move, while tricky is a bit more doable.

  3. #3
    Join Date
    Mar 2012
    Posts
    202
    I think the better question, is why you would want to do this?
    I do not think JavaScript is the best thing to use.

    Try using an <a> (anchor) element around the element where you want the top of the frame to start then reference it by using the name attribute like this:

    Code:
    <a name="whatever">START HERE<a>
    then when you start the iframe call the URL like this:

    Code:
    doc.html#whatever

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles