Tuesday, February 14, 2012

Change HTML form content using JavaScript


This code is for Change form element value using JavaScript

Before change of form content

After Change of form Content  
 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="javascript.aspx.cs" Inherits="javascript" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
   
    <script language=javascript>
     function check()
     {
            
       document.getElementById("myp").innerHTML="Content has changed";
     
    }
    </script>
   
   
</head>
<body>
    <form id="form1">
    <div>
   
    <p id="myp">Click button to change me</p>
        <input id="Button1" type="button" value="button" onclick="check()" />
  
    </div>
    </form>
</body>
</html>

No comments:

Post a Comment