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 822521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:48:40+00:00 2026-05-15T02:48:40+00:00

I have two pages one is the main page and the another one is

  • 0

I have two pages one is the main page and the another one is the inner page:

Page names: main.jsp , sidebar.jsp
I want to call the onload function on both of these pages. Is that possible. If yes How?

Below is the code for main.jsp:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ include file="/pages/common/init.jsp"%>

<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <title>J.C. Taylor - Broker Website</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <link rel="stylesheet" href="/css/default.css" media="screen" type="text/css" />
</head>
<body onload="prepopulateFields();load(17);">

<s:form name="continue" id="continue_id" action="continue" method="POST"  validate="true" enctype="multipart/form-data">
    <div id="wrapper">
        <div id="main">
                <div id="sidebar">
                    <%@ include file="/pages/common/sidebar.jsp"%>
                    <span class="clearIt"></span>
                </div>

The sidebar.jsp is:

<body onload="setSelected();">
 //Some static content here
</body>

So Basically I want is to call prepopulateFields() Javascript method which belongs to onload() event of the main .jsp page and setSelected() which belongs to onload() method of the sidebar.jsp symulatneously and separately.

I know I can call the setSelected(); method inside the prepopulateFields() method but that I dont want to do. All I want is when the page is loaded both the onload functions should be called separately.

If you have some suggestions please do let me know!
I know I am being little bit ridiculous here but if I could do that My job will be very easy.

  • 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-15T02:48:41+00:00Added an answer on May 15, 2026 at 2:48 am

    i don’t think you can call more than one onload function.
    best way is to call the method from already called function

    function prepopulateFields(){
        if //condition which check the current page where you want other onload function
           setSelected();
    }
    
    <body onload="prepopulateFields();load(17);">
    
    
    
    </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two jsp(one is main page, another one is new window) and single
I have two pages that inherit from one master page, First.aspx or second.aspx. Navigation
I have two forms on one page and want to have the input boxes
I have two viewstacks one for Main menu and another one for submenu. I
I have two pages: index.html and main.html When i set the main.html page to
I have 2 two php pages.One is the main and include the second and
I have two layouts(xml files) and I want to flip from one page to
I have two separate pages: Page A: Main page where user submits an issue
I have two pages (main.xaml and page1.xaml). When button is clicked in home page
I have two pages, one that edits user information, and one that edits information

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.