Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with basic javascript syntax

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

Open in new window

0
Comment
Question by:Gary Samuels
3 Comments
 
LVL 34

Assisted Solution

by:Big Monty
Big Monty earned 1000 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():>
0
 
LVL 58

Accepted Solution

by:
Gary earned 1000 total points
ID: 40328243
Check the case

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

Author Closing Comment

by:Gary Samuels
ID: 40328257
Thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to create an extensible mechanism for linked drop downs.
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

885 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