Hi guys,
My code isnt't working. This property is supposed to return the length of the string in characters. What's wrong?
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html lang=”EN” dir=”ltr” xmlns=”http://www.w3.org/1999/
xhtml”>
<head>
<meta http-equiv="content-type" content="text/xml;
charset=utf-8" />
<title>HelloWorld.html</title>
<script type = “text/javascript”>
//<![CDATA[
//from nameLength.html
var person = prompt(“Please enter your name.”);
var length = person.length;
alert(“Hi, “ + person + “!”);
alert(“The name “ + person + “ is “ + length + “
characters long.”);
//]]>
</script>
</head>
<body>
Dit is een test.
</body>
</html>
Page 1 of 1
nameLength
#2
Posted 03 September 2011 - 02:42 PM
Did you copy this from an online blog or something similar? Blogs like Wordpress change the straight double quote (") to a typographically correct slanted quote. This means you need to go through and replace any double quotes with the standard double quote from the keyboard.
Also, you can't separate your alert() into two lines, so this needs to be put on one line:
Also, you can't separate your alert() into two lines, so this needs to be put on one line:
alert(“The name “ + person + “ is “ + length + “ characters long.”);
Benjamin Falk | Falken Creative : Twitter : KillerSites Screencast Blog
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
Share this topic:
Page 1 of 1

Help











