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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:37:12+00:00 2026-05-22T00:37:12+00:00

I am getting a problem with these two scripts I coded, it appears as

  • 0

I am getting a problem with these two scripts I coded, it appears as though whichever script is on the bottom functions, so if I switch them around the one on bottom works. Please help. Code is below:

<script type="text/javascript">
window.onload = function() {
//Badge
var eSelect = document.getElementById('leftbadge');
        var yellowplate = document.getElementById('numberplateyellow');
        var whiteplate = document.getElementById('numberplatewhite');
        eSelect.onchange = function() {
            if(eSelect.selectedIndex === 0) {
                yellowplate.style.backgroundImage = 'url("builder/yellow_bg.png")';
                whiteplate.style.backgroundImage = 'url("builder/white_bg.png")';
                yellowplate.style.textAlign = 'center';
                yellowplate.style.paddingRight = '0';
                whiteplate.style.textAlign = 'center';
                whiteplate.style.paddingRight = '0';
            }else if(eSelect.selectedIndex === 1) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_ENG.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_ENG.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }else if(eSelect.selectedIndex === 2) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_GB.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_GB.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }else if(eSelect.selectedIndex === 3) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_GB2.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_GB2.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }else if(eSelect.selectedIndex === 4) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_SCO.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_SCO.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }else if(eSelect.selectedIndex === 5) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_CYMRU.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_CYMRU.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }
        }
}
</script>
<script type="text/javascript">
//Font
        window.onload = function() {
        var eSelect = document.getElementById('font');
        var yellowplate = document.getElementById('numberplateyellow');
        var whiteplate = document.getElementById('numberplatewhite');
        eSelect.onchange = function() {
            if(eSelect.selectedIndex === 0) {
                yellowplate.style.fontFamily = 'JepsonCarRegular';
                whiteplate.style.fontFamily = 'JepsonCarRegular';
            } else {
                yellowplate.style.fontFamily = 'twotoneRegular';
                whiteplate.style.fontFamily = 'twotoneRegular';
            }
        }
    }
</script>

So in this example the font will change but the badges wont if I try there drop down

  • 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-22T00:37:13+00:00Added an answer on May 22, 2026 at 12:37 am

    You’re assigning 2 actions to the window.onload. The bottom one will always execute because that is the last one that is assigned to (and hence, it has overriden the previous function assignment).

    You should look into merging the 2 onload actions into 1, a bit like this:

    <script type="text/javascript">
    function handleBadges()
    {
        //Badge
        var eSelect = document.getElementById('leftbadge');
        var yellowplate = document.getElementById('numberplateyellow');
        var whiteplate = document.getElementById('numberplatewhite');
        eSelect.onchange = function() 
        {
            if(eSelect.selectedIndex === 0) {
                yellowplate.style.backgroundImage = 'url("builder/yellow_bg.png")';
                whiteplate.style.backgroundImage = 'url("builder/white_bg.png")';
                yellowplate.style.textAlign = 'center';
                yellowplate.style.paddingRight = '0';
                whiteplate.style.textAlign = 'center';
                whiteplate.style.paddingRight = '0';
            }else if(eSelect.selectedIndex === 1) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_ENG.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_ENG.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }else if(eSelect.selectedIndex === 2) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_GB.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_GB.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }else if(eSelect.selectedIndex === 3) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_GB2.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_GB2.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }else if(eSelect.selectedIndex === 4) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_SCO.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_SCO.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }else if(eSelect.selectedIndex === 5) {
                yellowplate.style.backgroundImage = 'url(builder/yellow_bg_CYMRU.png)';
                whiteplate.style.backgroundImage = 'url(builder/white_bg_CYMRU.png)';
                //Align To Right and then add padding
                yellowplate.style.textAlign = 'right';
                yellowplate.style.paddingRight = '10px';
                whiteplate.style.textAlign = 'right';
                whiteplate.style.paddingRight = '10px';
            }
        }
    }    
    function handleFonts()
    {
        var eSelect = document.getElementById('font');
        var yellowplate = document.getElementById('numberplateyellow');
        var whiteplate = document.getElementById('numberplatewhite');
        eSelect.onchange = function() {
            if(eSelect.selectedIndex === 0) {
                yellowplate.style.fontFamily = 'JepsonCarRegular';
                whiteplate.style.fontFamily = 'JepsonCarRegular';
            } else {
                yellowplate.style.fontFamily = 'twotoneRegular';
                whiteplate.style.fontFamily = 'twotoneRegular';
            }
        }
    }
    window.onload = function() 
    {
        handleBadges()
        handleFonts()
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem with Unicode in asp These two address are created using the same function
I'm having a problem when trying to compile these two classes (Army and General)
i want to create these two tables but i'm getting an error which says
After having solved the problem of getting the editor to launch when there's a
I am getting problem to read pdf files using iText in java. I can
Having a problem getting a TreeView control to display node images. The code below
I'm getting this problem: PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable
I have a problem getting the right Price for a product based on Effectivity
I have a problem getting boost::multi_index_container work with random-access and with orderd_unique at the
I am having problem getting my tooltip to work when using the jQuery load()

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.