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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:21:10+00:00 2026-05-25T02:21:10+00:00

I get a javascript error invalid arguement when I use parseInt(). What am i

  • 0

I get a javascript error “invalid arguement” when I use parseInt(). What am i doing wrong?

The function is to increase the font size of every element on a frame by 1

<script>
   var sizeCounter = 1;
    function changeFontSize(){
        //var elements = parent.main.document.getElementsByTagName
        var myElements = parent.main.document.getElementsByTagName('*')

        for (i=0;i<myElements.length;i++){
                if(myElements[i].style.fontSize != null){       
                        var elmFontSize = myElements[i].style.fontSize + "";
                        elmFontSize.replace("px","");

                        if(elmFontSize != "") {
                            var elmFontSizeNum = parseInt(elmFontSize);

                        }
                            var resultSize = elmFontSizeNum + sizeCounter;

                            myElements[i].style.fontSize = resultSize + "px";


                        //alert(myElements[i].className)
                    }
                    sizeCounter++;
            }
    }


</script>
  • 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-25T02:21:10+00:00Added an answer on May 25, 2026 at 2:21 am

    There’s a lot wrong. Here’s a suggestion for simplifying/rewriting your function:

    function changeFontSize(sizeCounter){
     sizeCounter = sizeCounter || 1;
     var myElements = document.getElementsByTagName('*'), currentFontSize = 0;
     for (i=0;i<myElements.length;i++){
      var fsNow = getStyle(myElements[i],'font-size');
      if (fsNow){
       currentFontSize = Number(fsNow.replace(/[^\d]/g,''));
       myElements[i].style.fontSize = (currentFontSize + sizeCounter) + 'px';
      }
     }
    }
    

    Where getStyle is:

    function getStyle(el,styleProp)
    {
      el = /string/i.test(typeof el) ? document.getElementById(el) : el;
      if (!el){return null;}
      var result;
      if (el.currentStyle){
        return el.currentStyle[styleProp];
      }
      else if (window.getComputedStyle){
        return document.defaultView.getComputedStyle(el,null)
               .getPropertyValue(styleProp);
      }
      return null;
    }
    

    See this jsfiddle

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

Sidebar

Related Questions

I call my JavaScript function. Why do I sometimes get the error 'myFunction is
Does anyone know how to get the below to report a javascript error? (any
Using YUICompressor I get the following error from my javascript code: [ERROR] 270:201:missing name
As I use the web, I regularly get runtime errors (usually javascript) being reported
I am trying to get a JavaScript object to use the this assignments of
While testing JavaScript code in Firefox 3.5 I sometimes get the following error: Component
I am trying to get some JavaScript to programmatically adjust a HTML img tag's
Can JQuery/JavaScript read/get the file content on the client side, where the file is
I am using javascript to get the referring page (document.referrer) which works fine and
I'm trying to get client-side javascript objects saved as a file locally. I'm not

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.