mahdi_apple
دوشنبه 17 تیر 1392, 12:55 عصر
با سلام
من کد زیر رو از روی آموزش استاد کیانیان نوشتم و بخوبی بر روی IE اجرا میشه اما در فایرفاکس و کروم هیچ عکس العملی نشون نمیده.
خودم فکر کنم مشکل از متد deleteRow باشه.
لطفا اگه امکان داره کمکم کنید.
<!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=utf-8" />
<title>Untitled Document</title>
<script src="ajax.js" language="javascript" defer="defer">
</script>
<script language="javascript">
function del(id)
{
var table = document.getElementById("tbl");
var tr = document.getElementById("tr"+id);
table.deleteRow(tr.rowIndex);
}
</script>
</head>
<body>
<table width="300" border="1" cellspacing="0" cellpadding="5" id="tbl">
<tr>
<td bgcolor="#CCCCCC">ID</td>
<td bgcolor="#CCCCCC">Title</td>
<td bgcolor="#CCCCCC">Agency</td>
<td bgcolor="#CCCCCC">Operation</td>
</tr>
<?php
$ServerName="localhost";
$port="3306";
$DBname="newsmanagedb";
$User="root";
$pass="";
$link = mysql_connect($ServerName.":".$port,$User,$pass);
mysql_select_db($DBname,$link);
$sql = "select * from news";
$result = mysql_query($sql,$link);
$row="";
while($row=mysql_fetch_assoc($result))
{?>
<?php $id = $row["nid"]; ?>
<tr id="tr<?php print($id); ?>">
<td><?php print($row["nid"]); ?></td>
<td><?php print($row["ntitle"]); ?></td>
<td><?php print($row["nagency"]); ?></td>
<td><input type="button" value="Delete" id="Delete" onclick="sendToServerForDelete(<?php print($id); ?>);"/></td>
</tr>
<?php
}
mysql_close($link);
?>
</table>
</body>
</html>
من کد زیر رو از روی آموزش استاد کیانیان نوشتم و بخوبی بر روی IE اجرا میشه اما در فایرفاکس و کروم هیچ عکس العملی نشون نمیده.
خودم فکر کنم مشکل از متد deleteRow باشه.
لطفا اگه امکان داره کمکم کنید.
<!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=utf-8" />
<title>Untitled Document</title>
<script src="ajax.js" language="javascript" defer="defer">
</script>
<script language="javascript">
function del(id)
{
var table = document.getElementById("tbl");
var tr = document.getElementById("tr"+id);
table.deleteRow(tr.rowIndex);
}
</script>
</head>
<body>
<table width="300" border="1" cellspacing="0" cellpadding="5" id="tbl">
<tr>
<td bgcolor="#CCCCCC">ID</td>
<td bgcolor="#CCCCCC">Title</td>
<td bgcolor="#CCCCCC">Agency</td>
<td bgcolor="#CCCCCC">Operation</td>
</tr>
<?php
$ServerName="localhost";
$port="3306";
$DBname="newsmanagedb";
$User="root";
$pass="";
$link = mysql_connect($ServerName.":".$port,$User,$pass);
mysql_select_db($DBname,$link);
$sql = "select * from news";
$result = mysql_query($sql,$link);
$row="";
while($row=mysql_fetch_assoc($result))
{?>
<?php $id = $row["nid"]; ?>
<tr id="tr<?php print($id); ?>">
<td><?php print($row["nid"]); ?></td>
<td><?php print($row["ntitle"]); ?></td>
<td><?php print($row["nagency"]); ?></td>
<td><input type="button" value="Delete" id="Delete" onclick="sendToServerForDelete(<?php print($id); ?>);"/></td>
</tr>
<?php
}
mysql_close($link);
?>
</table>
</body>
</html>