Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 92
  • Last Modified:

Help with basic javascript syntax

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
Gary Samuels
Asked:
Gary Samuels
2 Solutions
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
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
 
GaryCommented:
Check the case

document.getElementById("MyEdit").innerHTML="My new text!";
0
 
Gary SamuelsPlant ManagerAuthor Commented:
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now