void : void « Statement « JavaScript Tutorial






Syntax

void(expression)
    void expression

The void operator is used to evaluate an expression without returning a value.

This operator returns undefined and is commonly used in place of the onClick event handler.

The following example uses the void Operator to Call a Function.

<html>
    <head>
      <title>Examples of the void Operator</title>
    <script language="JavaScript">
    <!--
    function myFunc(){
      alert("You clicked the link!");
    }
    -->
    </script>
    </head>
    <body>
    <A HREF="javascript:void(myFunc())">Click here to call the function</A>
    </body>
    </html>








3.12.void
3.12.1.void