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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:51:30+00:00 2026-05-24T17:51:30+00:00

What is wrong with the following htmla and javascript code formToConvert.html <html> <head> <title>ExampleToConvert</title>

  • 0

What is wrong with the following htmla and javascript code

formToConvert.html

<html>
    <head>
        <title>ExampleToConvert</title>
        <script type = "text/javascript" src = "con.js"></script>
    </head>
    <body> 
        <form id ="myform">
            <input type = "text" id = "field1" value = "Enter text Here"/><br/>
            <input type ="submit" value = "submit" onclick = "convert()"/>
        </form>
    </body> 
</html>

con.js

function convert() 
{
    var str ;
    str = document.getElementById("field1");
    document.writeln(str.toUpperCase());
}

Why is the above code not giving me the desired result?

  • 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-24T17:51:31+00:00Added an answer on May 24, 2026 at 5:51 pm

    Try:

    str = document.getElementById("field1").value;
    

    This is because getElementById returns a reference to your HTML Element, not the “text”-value that is contained.

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

Sidebar

Related Questions

I have the following code. <html> <head> <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js></script> </head> <div id=hello>Hello <div>Child-Of-Hello</div></div>
I have the following code: <html> <head> </head> <body> <script type=text/javascript> var frame =
With the following code: <script type=text/javascript src=../../Scripts/jquery-1.4.1.js /> <script type=text/javascript> $(function () { $('#selectOptions').change(function
I have the following code on an html page: <script type=text/javascript> <!-- window.location.replace(http://www.example.com/); -->
I have the following jquery-code: <script type=text/javascript> $(document).ready(function() { $ ('ul.image-list li:even').addClass ('even'); $
I have the following HTML w/Javascript code (note: this only works in Internet Explorer):
i have the following html code : <FORM name=frmmail> <input id=dochtmlContent type=hidden name=dochtmlContent value=oldValue/>
I try to implement the following code: html <span id = myset>school</span> Javascript var
Whats wrong with the following c# code? Compiler reports this error: Inconsistent accessibility: parameter
The following code produces wrong and inconsistent output with gcc (4.1.2 20080704) but correct

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.