My javascript is not loading. I already check to see that it is enable.
This is the error I get, SCRIPT1014: Invalid character
string.js, line 1 character 1
on the following code

String Object

var myString = ‘Learning about Built-in Object is easy’;
myString = myString.substring(15,31);
myString = myString.toUpperCase();
document.body.innerHTML += “

” + myString + “


I try everything even running on firefox and chrome and still does not work

What are the contents of “string.js”?

Well first, you’ll need to use proper syntax:

<script type="text/javascript" src="string.js"></script>

The above code assumes string.js resides in the same directory as the web page you’re calling it from.

Second, you have your tags in the wrong order. The goes above

Third, you have no doctype designated so the browser is left to guess what the code is.

Try this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<title>String Object</title>
<meta name="description" content="A web page about string objects.">
<meta charset="utf-8">
<script type="text/javascript" src="string.js"></script>

This also assumes that string.js needs to be in the body and not the head section.

The code is perfectly valid HTML5 but the closing element should be immediately above the opening tag (on line 6).