Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JavaScript

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25853
    spikywires
    Member

    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.

    #62624
    soap
    Participant

    <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)
  • The forum ‘JavaScript’ is closed to new topics and replies.