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

  • Home
  • SEARCH
  • 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 8602609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:07:36+00:00 2026-06-12T02:07:36+00:00

I am using the following code to show or hide a table depending on

  • 0

I am using the following code to show or hide a table depending on the checkbox is selected or not..

<body onload="document.f.firstfield.focus(),showOnLoad();">

My Javascript is:

function showOnLoad(){
        if((document.getElementById('chk').checked)){
            document.getElementById('div1').style.display = "block";}else{
        document.getElementById('div1').style.display = "none";}
    }

Its working fine till this. But, now I wanted to use another function showSomething() which does the same functionality as above but for different checkbox and different table.

when I change my code line to this:

<body onload="document.f.firstfield.focus(),showSomething(),showOnLoad();">

both functions are not working. How can I make them both work together?
Any help is appreciated!

  • 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-06-12T02:07:38+00:00Added an answer on June 12, 2026 at 2:07 am

    You need to use ; to terminate the function calls. Use:

    document.f.firstfield.focus();showSomething();showOnLoad();
    

    In normal JavaScript (not inline HTML), you may use a newline character or ; (you can read more about that by Googling… maybe https://mislav.net/2010/05/semicolons/ will help). When you want to use inline JavaScript but need several statements, you MUST use ;. A , is never used for this kind of purpose.

    And not that it matters… it’s just preference… but I would create a generic function that you call, say bodyLoad, where these three statements are executed (so the HTML would become <body onload="bodyLoad();">). It’s much easier to manage when you know "everything" you want to do on load will be inside of this function. There are other things I’d do too, but I’ll leave it at that…

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

Sidebar

Related Questions

I am using following code to show a spinning wheel: $(#loading) .hide() .ajaxStart(function(){ $(this).show();
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am using the following code to hide and show a label in my
I'm using the following code to hide a division on the page load: $(document).ready(function()
I am using the following code to show and hide two div positioned absolutely
Im using the following code <script src=http://code.jquery.com/jquery-latest.js></script> <script> //Document ready $(document).ready(function(){ //Show info $('a.getinfo').live(click,
I am trying to hide/show elements in a view using following code: $('buttonClass/IDhere').click(function (){
I'm using the following jQuery code to hide and show some HTML element in
I'm currently using the following code to show / hide a ProgressDialog in my
I'm using the following code to show and hide a label on a text

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.