Page error duplicating Joe Stangler's sample HTML page. . . ?

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Hi,

I was watching one of Joe Stangler's asp videos and he started with using
HTML controls and a line of javascript. I think I've duplicated the page
correctly but the browser is saying that there is a semi-colon at line 22,
char 8. I don't know why it needs a semi-colon on line 22. The result is
that the control called HTMLButton doesn't update the specified label. You
should be able to throw this into a page and see the error yourself.

Can anyone scrutinize this snippet and tell me what I've done wrong? Thanks
alot! Jim M.

'**********************************************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<meta content = "text/html; charset = utf-8" http-equiv = "Content-Type" />

<script language = "javascript" type ="text/javascript">

// <!CDATA[

function HTMLButton_click() {

document.getElementById('Label1').innertext = "Hey, text from HTML button";

}

//]>


</script>

<head>

<title>Test Page</title>

</head>

<body>

<form method ="post" action = "http://www.microsoft.com">

<input name = "text1" type = "text"/>

<br /> <br />

<label id = "Label1">Temp Value</label>

<br /> <br />

<input name = "HTMLButton" type = "button" value ="Click me for a suprise!"
onclick = "Return HTMLButton_click()" />

<br /><br />

<input id="SubmitForm" type="submit" value="Click to Submit" />


</form>


</body>

</html>

'**********************************************
 
JavaScript is a case-sensitive language, the word "innertext" should be
"innerText" and in your button's code, you've written "Return", which should
be "return".

-Scott
 
Thanks alot! I knew it had to be some elusive little quirks like that!

Scott M. said:
JavaScript is a case-sensitive language, the word "innertext" should be
"innerText" and in your button's code, you've written "Return", which
should be "return".

-Scott


Jim said:
Hi,

I was watching one of Joe Stangler's asp videos and he started with using
HTML controls and a line of javascript. I think I've duplicated the page
correctly but the browser is saying that there is a semi-colon at line
22, char 8. I don't know why it needs a semi-colon on line 22. The
result is that the control called HTMLButton doesn't update the specified
label. You should be able to throw this into a page and see the error
yourself.

Can anyone scrutinize this snippet and tell me what I've done wrong?
Thanks alot! Jim M.

'**********************************************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<meta content = "text/html; charset = utf-8" http-equiv = "Content-Type"
/>

<script language = "javascript" type ="text/javascript">

// <!CDATA[

function HTMLButton_click() {

document.getElementById('Label1').innertext = "Hey, text from HTML
button";

}

//]>


</script>

<head>

<title>Test Page</title>

</head>

<body>

<form method ="post" action = "http://www.microsoft.com">

<input name = "text1" type = "text"/>

<br /> <br />

<label id = "Label1">Temp Value</label>

<br /> <br />

<input name = "HTMLButton" type = "button" value ="Click me for a
suprise!" onclick = "Return HTMLButton_click()" />

<br /><br />

<input id="SubmitForm" type="submit" value="Click to Submit" />


</form>


</body>

</html>

'**********************************************
 
Back
Top