Menu ▼

Previous Next

Button :

For input tag we have to specify the type as "button", then it will render a button in output.

Syntax :

<input type="button" />

Example :



    <title>HTML Tutorial</title>

    <script language="javascript">

        function checkcomments() {

            if (document.getElementById("txtComments").value == "")

                alert("Please enter your comemnts.");






        Please post your comments :<br />

        <textarea id="txtComments" name="txtComments" rows="10" cols="50"></textarea>

        <br />

        <input type="button" id="btnPost" value="Post" onclick="checkcomments();" />




Output :
HTML Tutorial
Please post your comments :

Previous Next