Forum Moderators: open
I need to alert the text what i entered in the text box and need to alert the price value which is to the side of the $ symbol
If remove the $ symbol and alert the price then i can see the Price
but i need the $ symbol there but in alert there is no need to pass the $ symbol only pass the price i.e 1000
here is my code
<html>
<head>
<script type="text/javascript">
function cell(i)
{
//var x=document.getElementById('myTable').rows[0].cells;
//alert(x[0].innerHTML);
var x=document.getElementById('myTable')
var y = x.rows[i].cells[1].firstChild.value;
var z = x.rows[i].cells[0].firstChild[getElementById(txt1).value];alert(y);
alert(z);
}
</script>
</head>
<body>
<?php
$price=1000;
echo'<table id="myTable" border="1">';
for ($i=0; $i<3; $i++)
{
echo'<tr>
<td>$<input type="text" id="txt1" value="'.$price.'" disabled/></td>
<td> <input type="text" id="txt"/></td>
<td> <input type="button" onClick="cell('.$i.')" value="Alert"></td>
</tr>';
}
echo'</table>';
?>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function cell(i) {
var y = document.getElementById('txtA'+i).value;
var z = document.getElementById('txtB'+i).value;
alert(y);
alert(z);
}
</script>
</head>
<body>
<?php
$price=1000;
echo'<table id="myTable" border="1">';
for ($i=0; $i<3; $i++) {
echo'<tr>
<td>$<input type="text" id="txtA'.$i.'" value="'.$price.'" disabled/></td>
<td> <input type="text" id="txtB'.$i.'"/></td>
<td> <input type="button" onclick="cell('.$i.')" value="Alert"></td>
</tr>';
}
echo'</table>';
?>
</body>
</html>