Web Analytics Made Easy -
StatCounter Not sure why this simple script won't work - CodingForum

Announcement

Collapse
No announcement yet.

Not sure why this simple script won't work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Not sure why this simple script won't work

    I am learning how to use javascripts and I am starting real slow, but this script won't work.

    Code:
    <body bgcolor="#000000">
    <div id="mainpage">
    	<div id="logo"></div>
    	<a href="#" onclick="alert("This is a test");">This is test</a>
    </div>
    </body>
    </html>
    "mainpage" and "logo" are defined styles, and the I have this for a doctype:
    Code:
    <!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">
    I've tried other doctypes and they don't work either. If I took the alert out of the onclick, then it works. Does anybody have any idea what really simple and silly mistake I am making

  • #2
    Nested quotes

    <a href="#" onclick="alert('This is a test');">This is test</a>
    Glenn
    vBulletin Mods That Rock!

    Comment


    • #3
      silly mistake being the operative word there. Thanks for the help.

      Comment

      Working...
      X