void : void : Statement JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Statement » void »

 

void











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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Statement
» void