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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:39:48+00:00 2026-06-11T17:39:48+00:00

I am Still messing with this calculator coded in JavaScript. I’m asking this question

  • 0

I am Still messing with this calculator coded in JavaScript. I’m asking this question on how do I make it so that it stops showing an alert for the output and prints it into the div tag below named “Output”.

I’ve already placed in what I think it would be in the Output and I have pasted this below:

 <html>
    <head>
    <link href="stylesheet/stylesheet.css" rel="stylesheet" type="text/css">

    <script type="text/javascript">



    function checkinputs(){
    var     A = parseInt(document.triangleform.input1.value);
    var     B = parseInt(document.triangleform.input2.value);
    var     C = parseInt(document.triangleform.input3.value);


        if (A == B && B == C) { alert("Equalateral"); } 
        if (A == B && B != C || B == C && A != B || C == A && A != B) {alert("Isosceles");} 
        if (A != B && B != C && C != A) {alert("Scalene!");} 
    }



    function keypress(evt) {
      var theEvent = evt || window.event;
      var key = theEvent.keyCode || theEvent.which;
      key = String.fromCharCode( key );
        var regex = /[0-9]|\./;
      if( !regex.test(key) ) {
        theEvent.returnValue = false;
        if(theEvent.preventDefault) theEvent.preventDefault();
      }
    }

    function notEmpty(field, NocharMsg){
        if(field.value.length == 0){
            alert(NocharMsg);
            field.focus();
            return false;
        }
        return true;
    }
    </script


    </head>
    <body>
    <div id="Container">

    <div id="Header"><h1></h1></div>

            <div id="Content_1">
                    <div id="Explanation">
                    This calculator will determine what
                    triangle you have made depending on
                    the integer values in the input fields.

                    </div>
                    <div id="Form">
                        <FORM NAME="triangleform">
                        Enter the triangle values below: <br>
                        <p>
                        <h4>Side 1: </h4><BR>
                        <INPUT TYPE="Integer" NAME="input1" onkeypress='keypress(event)' /><P>
                        <h4>Side 2: </h4><BR>
                        <INPUT TYPE="Integer" NAME="input2" onkeypress='keypress(event)' /><P>
                        <h4>Side 3:</h4> <BR>
                        <INPUT TYPE="Integer" NAME="input3" onkeypress='keypress(event)' /><P>
                        <INPUT TYPE="button" NAME="Submit" Value="Submit" onClick="checkinputs()" />
                        </FORM>
                    </div>
                    <div id="Verbal_Output">
                        <h2>You made a:</h2>
                        <p>        
                        <h2>Triangle</h2>
                    </div>

                </div>
                <p>
                <p>
            <div id="Content_2">

            <div id="Output">
            <script>
            document.getElementById("Output").value = checkinputs();

            </script>   
            </div>



    </body>
    </html>

Thank you very much.

  • 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-11T17:39:49+00:00Added an answer on June 11, 2026 at 5:39 pm

    Nearly there – a div doesn’t have a value property (that’s for form inputs), but it does have a innerHTML property. Just make sure you return the values you want from checkInputs(), instead of alerting them.

    For example:

    function checkinputs() {
        var A = parseInt(document.triangleform.input1.value),
            B = parseInt(document.triangleform.input2.value),
            C = parseInt(document.triangleform.input3.value),
            result;
    
    
        if (A == B && B == C) { result = "Equilateral"; } 
        if (A == B && B != C || B == C && A != B || C == A && A != B) { result ="Isosceles";} 
        if (A != B && B != C && C != A) { result = "Scalene!";} 
    
        // return result;
        document.getElementById("Output").innerHTML = result;
    }
    

    Then in your markup:

    <script>
            document.getElementById("Output").innerHTML = checkinputs();
    </script>
    

    Note that .innerHTML is case-sensitive.

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

Sidebar

Related Questions

UPDATE So I am still messing with this, and have gotten as far as
Ive been messing with this a while and have tried numerous ways. It still
So I've been messing around with this all day, and I still can't get
My question is very similar to the one described in this post: Javascript progress
I've been messing with this all day and have still not found a solution.
Alright I've been messing around with this for hours now and I still can't
This is a continuance from a SO Q here but I am still missing
Alright, I am still messing around with Core Data in my iOS project, and
So I'm still fairly new to web page design and I've been messing around
Still learning Objective-C / iPhone SDK here. I think I know why this wasn't

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.