Help with basic javascript syntax

Posted on 2014-09-17
Last Modified: 2014-09-17
Can someone tell me what is wrong with the following
  <script type="text/javascript">
  function TextInsert() {
	document.getElementById("MyEdit").innerHtml="My new text!";
  <body onload=TextInsert()>
  <div id="MyEdit">&nbsp;</div>

Open in new window

Question by:Gary Samuels
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 250 total points
ID: 40328241
javascript is case sensitive, change your code to:

document.getElementById("MyEdit").innerHTML="My new text!";

also, put your function call in quotes:

<body onload="TextInsert():>
LVL 58

Accepted Solution

Gary earned 250 total points
ID: 40328243
Check the case

document.getElementById("MyEdit").innerHTML="My new text!";

Author Closing Comment

by:Gary Samuels
ID: 40328257

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
object method as an event handler 8 77
Jquery Calculation 3 42
Sticking text to shapes in Raphael.js 6 41
Drag & Drop Error 5 32
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question