Friday, March 30, 2012

Some important codes for website what we need always

How to setup onblur function:

<html>
    <head>
  
        <title>onBlur and onFocus - Tutorial</title>
    </head>
    <body>
        <form>
        <input  type="text" id="email" name="email" value="Your Email" />
          
            <input type="text" id="name" value="Your Name" />
            <input type="submit" value="Submit" />
           
           
           
            <input type="text" onBlur="if (this.value == '') {this.value = 'Search for...';}" onFocus="if(this.value == 'Search for...') {this.value = '';}" value="Search for..." name="search" >
           
           
        </form>
         <script type="text/javascript">
    var emailField = document.getElementById("email");

emailField.onfocus = function() {
    if (emailField.value == "Your Email") {
        emailField.value = "";
    }
};
emailField.onblur = function() {
    if (emailField.value == "") {
        emailField.value = "Your Email";
    }
};
</script>
       
    </body>
   
</html>


How to close a popup window:

<a href="javascript:window.close()"> alt="close" />Close</a>

Developer and Project Manager: Ashik Mahmud

Odesk Hire Link: 





No comments: