Posts

use window dot location in java script

Click the following button, you will be redirected to home page. <html>    <head>             <script type="text/javascript">          <!--             function Redirect() {                window.location="http://www.google.com";             }          //-->       </script>          </head>      <body>       <p>Click the following button, you will be redirected to home page.</p>             <form>          <input type="button" value="Redirect Me" onclick="Redirect();" />       </form>          </body> </html>

Set Cookes in java script

Set Cookes <html>    <head>             <script type = "text/javascript">          <!--             function WriteCookie()             {                if( document.myform.customer.value == "" ){                   alert("Enter some value!");                   return;                }                cookievalue= escape(document.myform.customer.value) + ";";                document.cookie="name=" + cookievalue;                document.write ("Setting Cookies : " + "name=" + cookievalue );             }   ...

using onmouseover in javascript

onmouseover  <html>    <head>         <script type="text/javascript">          <!--             function over() {                document.write ("Mouse Over");             }                         function out() {                document.write ("Mouse Out");             }                      //-->       </script>          </head>    <body>       <p>Bring your mouse inside the division to see the result:</p>             <div onmouseover="over()" onmouseout="out()"> ...

using onsubmit event and post method in javascript

onsubmit event and post method  <html>    <head>         <script type="text/javascript">          <!--             function validation()          {                all validation goes here                .........                return either true or false             }          //-->       </script>          </head>    <body>         <form method="POST" action="ex1.html" onsubmit="return validate()">          .......          <input type="submit" value="Submit" />       </form>   ...

Set the variable to different object and then try...

variable to different object <html>    <body>             <script type="text/javascript">          <!--             var index;             document.write("Navigator Object Properties<br /> ");                     for (index in anurag) {                document.write(aProperty);                document.write("<br />");             }             document.write ("Exiting from the loop!");          //-->       </script>             <p>Set the variable to different object and then try...</p>    </body> </html>

Set the variable to different value and then try..

Set the variable to different value <html>    <body>             <script type="text/javascript">          <!--             var age = 20;                     if( age > 15 ){                document.write("<b>Qualifies for driving</b>");             }          //-->       </script>             <p>Set the variable to different value and then try...</p>    </body> </html>

Set the variables to different values and different operators and then try...

 different values and different operators <html>    <body>         <script type="text/javascript">          <!--             var a = 10;             var b = 20;             var linebreak = "<br />";                   document.write("(a && b) => ");             result = (a && b);             document.write(result);             document.write(linebreak);                     document.write("(a || b) => ");             result = (a || b);             document.write(result);             document.write(lineb...