Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3673434
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:43:58+00:00 2026-05-19T02:43:58+00:00

I have a page (and divs) that are being dynamically generated and what I

  • 0

I have a page (and divs) that are being dynamically generated and what I need for this page to do is to scroll to a particular div immediately after the page loads. What is screwy about this code is this…

The “button” code below, when you run the mouse over it (or onclick), works perfectly. It executes the rolldownTo function perfectly. However when I try to specify to specify the same action using window.onload, nothing happens. I have included both the “button ” code and the window.onload below.

<html>
<head>
<title>Help</title>

<script LANGUAGE="JavaScript1.2" type="text/javascript" 
    src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"
    djConfig="usePlainJson : true, parseOnLoad: true">
</script>

<script type="text/javascript">
    dojo.require("dojo.parser");
    dojo.require("dijit.form.FilteringSelect");
    dojo.require("dijit.form.TextBox");
    dojo.require("dijit.layout.ContentPane");
    dojo.require("dijit.layout.BorderContainer");
    dojo.require("dijit.layout.TabContainer");
    dojo.require("dojo.data.ItemFileReadStore");
    dojo.require("dojo.window");


function rolldownTo(my_anchor){
    dojo.window.scrollIntoView(my_anchor);
}

window.onload=rolldownTo('car_help');
</script>

<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs    /dojo/1.5/dijit/themes/claro/claro.css"/>
</head>

<body class="claro">

<div dojoType="dijit.layout.BorderContainer" style="width: 100%; height: 100%;">
    <div dojoType="dijit.layout.TabContainer" region="center">
        <div dojoType="dijit.layout.ContentPane" title="CAR HELP" selected=true>
           <button type=button id=button1 onmouseover="rolldownTo('car_help');">
             scroll to car_help
            </button>
            ........
            LOTS OF DIVS LIVE IN THIS DIV, INCLUDING MY TARGET "car_help"
            ........  
 </div>
        <div dojoType="dijit.layout.ContentPane" title="BIKE HELP" selected=false>
     ........
            ........
        </div>
    </div>
</div>
<script language="JavaScript1.2" type="text/javascript">
.... LOTS OF CODE THAT GENERATES CONTENT FOR THE DIVS ABOVE
</script>

</body>

</html>

Does anyone have an idea why a Javascript event like onmouseover or onclick would work perfectly but window.onload will not?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:43:59+00:00Added an answer on May 19, 2026 at 2:43 am

    The page load doesn’t mean the the DOM tree has been fully initialized which mean that your script cannot move the div unless the tree finish working, you must wait it until finished by using the javascript Event DOMContentLoaded.

    In dojo, There is a function that can be called, it waits until the browser finish the DOM Tree, you can use it as :

    dojo.addOnLoad(function(){rolldownTo('car_help');});
    

    I hope this would work for you

    Best Regards
    NiL

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page with DIV s with a mouseover handler that is
I have a page that is generated which inserts an HTML comment near the
I have a list that is being fed in to my page using an
I have this flash object that is being displayed in the middle of the
I'm trying to hide some divs that I have created dynamically using the .hide()
I have a list of divs (div.row), which I need to update the background-color
I have multiple divs in my page as: <div imageId='image5' name='5' class='speechBubble'> <div imageId='image5'
I have a page with a series of divs. Each div represents a slide
We have an HTML page which displays a bunch of pretty bars using divs
If you have several div s on a page, you can use CSS to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.