Grow your CSS skills. Land your dream job.

JavaScript

  • # August 23, 2009 at 11:10 pm

    I am new to JavaScript. The code I’m using is…

    <HTML>
    <HEAD>
    <TITLE>Script in Html Tags</TITLE>

    <BODY>
    <INPUT TYPE = Button VALUE = "Click Me" OnClick = "document.write(‘Hello World’)>
    </BODY>
    </HTML>

    I get the button but ‘hello world’ doesn’t appear when I click it.

    # August 23, 2009 at 11:23 pm

    <INPUT TYPE = Button VALUE = "Click Me" OnClick = "document.write(‘Hello World’)>

    needs to be

    <input type="button" value="Click Me" onclick="document.write(‘Hello World’)" />

    you’re missing quotes on "button" and after document.write

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".