RRN
04-30-2007, 03:29 AM
Hi, please find the code below
------------------------------------------------------------------------------
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
function rebuilder(){
var tablebody=document.createElement("Tbody");
var newtable = document.getElementById("XTable");
var trow=new Array(20);
var tcolumn=new Array(20);
var imagee=new Array(20);
var a= 100;
alert("image will appear click on it should open another alert.");
trow[0]=document.createElement("tr");
///add text box
tcolumn[0]=document.createElement("td");
trow[0].appendChild(tcolumn[0]);
imagee = document.createElement("input");
imagee.type="text";
imagee.className="Txtfield";
imagee.name="New"+a;
imagee.value="";
imagee.size="11";
imagee.maxLength="10";
tcolumn[0].appendChild(imagee);
//add image
tcolumn[1]=document.createElement("td");
trow[0].appendChild(tcolumn[1]);
imagee = document.createElement("img");
imagee.src = "Cars.gif";
imagee.alt = "IMG";
imagee.width = "16";
imagee.height = "16";
imagee.border = "1";
imagee.onmousedown = function(){
var param = New+a;
func(param);
};
tcolumn[1].width="9%";
tcolumn[1].appendChild(imagee);
tablebody.appendChild(trow[0]);
newtable.appendChild(tablebody);
}
function func(nnn){
nnn.value = "20";
}
</script>
</head>
<body>
<input type="button" onclick="rebuilder()" value="Click the button first" />
<div id="rb">
<table border="1" id="XTable" cellspacing="0" cellpadding="0" style="border-collapse: collapse" width="20%">
<tr>
<td>Click image that will appear below</td>
</tr>
</table>
</div>
</body>
</html>
--------------------------------------------------------------------------
Help me to solve this issue. On clicking button, an image and a textbox will appear.On clicking image 20 should be enterd in the text box. But it is not doing so. How can this issue be fixed????
------------------------------------------------------------------------------
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
function rebuilder(){
var tablebody=document.createElement("Tbody");
var newtable = document.getElementById("XTable");
var trow=new Array(20);
var tcolumn=new Array(20);
var imagee=new Array(20);
var a= 100;
alert("image will appear click on it should open another alert.");
trow[0]=document.createElement("tr");
///add text box
tcolumn[0]=document.createElement("td");
trow[0].appendChild(tcolumn[0]);
imagee = document.createElement("input");
imagee.type="text";
imagee.className="Txtfield";
imagee.name="New"+a;
imagee.value="";
imagee.size="11";
imagee.maxLength="10";
tcolumn[0].appendChild(imagee);
//add image
tcolumn[1]=document.createElement("td");
trow[0].appendChild(tcolumn[1]);
imagee = document.createElement("img");
imagee.src = "Cars.gif";
imagee.alt = "IMG";
imagee.width = "16";
imagee.height = "16";
imagee.border = "1";
imagee.onmousedown = function(){
var param = New+a;
func(param);
};
tcolumn[1].width="9%";
tcolumn[1].appendChild(imagee);
tablebody.appendChild(trow[0]);
newtable.appendChild(tablebody);
}
function func(nnn){
nnn.value = "20";
}
</script>
</head>
<body>
<input type="button" onclick="rebuilder()" value="Click the button first" />
<div id="rb">
<table border="1" id="XTable" cellspacing="0" cellpadding="0" style="border-collapse: collapse" width="20%">
<tr>
<td>Click image that will appear below</td>
</tr>
</table>
</div>
</body>
</html>
--------------------------------------------------------------------------
Help me to solve this issue. On clicking button, an image and a textbox will appear.On clicking image 20 should be enterd in the text box. But it is not doing so. How can this issue be fixed????