|
|
|
สอบถามคร้าบบบบบบ เม้าชี้ในตาราง แล้วขึ้นสีตามเม้าอ่ะครับ |
|
|
|
|
|
|
|
ใช้ CSS
Code (PHP)
<style tyle="text/css">
.list1 tr:hover{
background-color:#fefefe;
}
</style>
<table class="list1">
<tr>
<td>1</td><td>a</td>
</tr>
<tr>
<td>2</td><td>b</td>
</tr>
<tr>
<td>3</td><td>c</td>
</tr>
</table>
หรือ Javascript
onMouseover="this.bgColor='#DDDDDD'" onMouseout="this.bgColor='#FFFFFF'"
Code (PHP)
<tr onMouseover="this.bgColor='#DDDDDD'" onMouseout="this.bgColor='#FFFFFF'"><td>1</td><td>2</td></tr>
|
|
|
|
|
Date :
2013-05-30 09:55:25 |
By :
Manussawin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตอบความคิดเห็นที่ : 1 เขียนโดย : Manussawin เมื่อวันที่ 2013-05-30 09:55:25
รายละเอียดของการตอบ ::
Code (PHP)
<html>
<head>
<title>MONITER ONLINE</title><br><center><b>MONITER ONLINE ROUND 1&2<b></br></center>
</head>
<center><body>
<?php
$ebits = ini_get('error_reporting');
error_reporting($ebits ^ E_NOTICE);
?>
<?
include 'conDB.php';
//*** Add Condition ***//
if($_POST["hdnCmd"] == "Add")
{
$strSQL = "INSERT INTO data_update1 ";
$strSQL .="(Barcode_th,Name_id,status,Route,Trip) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txtAddCustomerID"]."','".$_POST["txtAddName"]."' ";
$strSQL .=",'".$_POST["txtAddName1"]."' ,'".$_POST["txtAddEmail"]."' ";
$strSQL .=",'".$_POST["txtAddCountryCode"]."')";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "ทะเบียนซ้ำ";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
//*** Update Condition ***//
if($_POST["hdnCmd"] == "Update")
{
$strSQL = "UPDATE data_update1 SET ";
$strSQL .="No= '".$_POST["txtEditNo"]."'";
$strSQL .=",Barcode_th= '".$_POST["txtEditCustomerID"]."'";
$strSQL .=",Name_id = '".$_POST["txtEditName"]."'";
$strSQL .=",status = '".$_POST["txtEditName1"]."'";
$strSQL .=",Route = '".$_POST["txtEditRoute"]."'";
$strSQL .=",Trip = '".$_POST["txtEditCountryCode"]."'";
$strSQL .="WHERE ID = '".$_POST["hdnEditCustomerID"]."'";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Update [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
//*** Delete Condition ***//
if($_GET["Action"] == "Del")
{
$strSQL = "DELETE FROM data_update1 ";
$strSQL .="WHERE ID = '".$_GET["CusID"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Delete [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
$strSQL = "SELECT * FROM data_update1 ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<form name="frmMain" method="post" action="<?=$_SERVER["PHP_SELF"];?>">
<input type="hidden" name="hdnCmd" value="">
<table border="1">
<th width="97"> <div align="center">No</div></th>
<th width="97"> <div align="center">Regis</div></th>
<th width="5"> <div align="center">Sup</div></th>
<th width="198"> <div align="center">Check</div></th>
<th width="100"> <div align="center">ROUTE </div></th>
<th width="98"> <div align="center">TRIP</div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<?
if($objResult["ID"] == $_GET["CusID"] and $_GET["Action"] == "Edit")
{
?>
<tr>
<td><div align="center">
<td><input type="text" name="txtEditNo" size="20" value="<?=$objResult["No"];?>"></td>
<input type="text" name="txtEditCustomerID" size="7" value="<?=$objResult["Barcode_th"];?>">
<input type="hidden" name="hdnEditCustomerID" size="5" value="<?=$objResult["ID"];?>">
</div></td>
<td><input type="text" name="txtEditName" size="20" value="<?=$objResult["Name_id"];?>"></td>
<td><input type="text" name="txtEditName1" size="20" value="<?=$objResult["status"];?>"></td>
<td><input type="text" name="txtEditRoute" size="20" value="<?=$objResult["Route"];?>"></td>
<td><div align="center"><input type="text" name="txtEditCountryCode" size="2" value="<?=$objResult["Trip"];?>"></div></td>
<td colspan="2" align="right"><div align="center">
<input name="btnAdd" type="button" id="btnUpdate" value="Update" OnClick="frmMain.hdnCmd.value='Update';frmMain.submit();">
<input name="btnAdd" type="button" id="btnCancel" value="Cancel" OnClick="window.location='<?=$_SERVER["PHP_SELF"];?>';">
</div></td>
</tr>
<?
}
else
{
?>
<tr id=menu2 onMouseOver="switchColorOn('menu2'); this.style.cursor='hand';" onMouseOut="switchColorOff('menu2');" bgcolor=#FFFFFF>
<td><?=$objResult["No"];?></td>
<td><div align="center"><?=$objResult["Barcode_th"];?></div></td>
<td><?=$objResult["Name_id"];?></td>
<td><?=$objResult["status"];?></td>
<td><?=$objResult["Route"];?></td>
<td><div align="center"><?=$objResult["Trip"];?></div></td>
<td align="center"><a href="<?=$_SERVER["PHP_SELF"];?>?Action=Edit&CusID=<?=$objResult["ID"];?>">Edit</a></td>
<td align="center"><a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='<?=$_SERVER["PHP_SELF"];?>?Action=Del&CusID=<?=$objResult["ID"];?>';}">Delete</a></td>
</tr>
<?
}
?>
<?
}
?>
<tr>
<td><div align="center" ><input type="text" name="txtAddNo" size="5"></td>
<td><div align="center" size="10"><input type="text" name="txtAddCustomerID" size="5"></div></td>
<td><input type="text" name="txtAddName" size="20"></td>
<td><input type="text" name="txtAddName1" size="20"></td>
<td><input type="text" name="txtAddEmail" size="20"></td>
<td><div align="center"><input type="text" name="txtAddCountryCode" size="2"></div></td>
<td><input name="btnAdd" type="button" id="btnAdd" value="Add" OnClick="frmMain.hdnCmd.value='Add';frmMain.submit();">
</div></td>
</tr>
</table>
</form>
<?
mysql_close($objConnect);
?>
</body></center>
</html>
คือนี้เป็นโค้ดของผม ต้องใส่บรรทัดใหนครับ
|
|
|
|
|
Date :
2013-05-30 10:05:10 |
By :
สุท |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คือไม่รู้ว่าจะวางไว้ที่ใหนอ่ะครับ
เพราะ ข้อมูลผมจะดึงมาจากดาต้าเบท แล้วให้ขึ้นครับ
โค้ดที่ใหนมานี้มันสร้างตารางใหม่ใช่มั้ยครับ
เลยไม่รู้ว่าจะวางไว้ที่ใหน
|
|
|
|
|
Date :
2013-05-30 10:11:10 |
By :
สุท |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ใช้ css ช่วยครับ โดย
<style>
tr #menu2:hover { background:สีที่ต้องการ; }
</style>
ให้นำไปวางไว้ในส่วน <head> ครับ
ปล. ไม่แน่ใจว่าจะติดหรือเปล่านะครับ เผอิญพิมพ์ในโน้ดแพด
|
|
|
|
|
Date :
2013-05-30 10:35:52 |
By :
Fox |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>MONITER ONLINE</title><br><center><b>MONITER ONLINE ROUND 1&2<b></br></center>
<style tyle="text/css">
#tb1 tr:hover{
background-color:#fefefe;
}
</style>
</head>
<center><body>
<?php
$ebits = ini_get('error_reporting');
error_reporting($ebits ^ E_NOTICE);
?>
<?
include 'conDB.php';
//*** Add Condition ***//
if($_POST["hdnCmd"] == "Add")
{
$strSQL = "INSERT INTO data_update1 ";
$strSQL .="(Barcode_th,Name_id,status,Route,Trip) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txtAddCustomerID"]."','".$_POST["txtAddName"]."' ";
$strSQL .=",'".$_POST["txtAddName1"]."' ,'".$_POST["txtAddEmail"]."' ";
$strSQL .=",'".$_POST["txtAddCountryCode"]."')";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "ทะเบียนซ้ำ";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
//*** Update Condition ***//
if($_POST["hdnCmd"] == "Update")
{
$strSQL = "UPDATE data_update1 SET ";
$strSQL .="No= '".$_POST["txtEditNo"]."'";
$strSQL .=",Barcode_th= '".$_POST["txtEditCustomerID"]."'";
$strSQL .=",Name_id = '".$_POST["txtEditName"]."'";
$strSQL .=",status = '".$_POST["txtEditName1"]."'";
$strSQL .=",Route = '".$_POST["txtEditRoute"]."'";
$strSQL .=",Trip = '".$_POST["txtEditCountryCode"]."'";
$strSQL .="WHERE ID = '".$_POST["hdnEditCustomerID"]."'";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Update [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
//*** Delete Condition ***//
if($_GET["Action"] == "Del")
{
$strSQL = "DELETE FROM data_update1 ";
$strSQL .="WHERE ID = '".$_GET["CusID"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Delete [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
$strSQL = "SELECT * FROM data_update1 ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<form name="frmMain" method="post" action="<?=$_SERVER["PHP_SELF"];?>">
<input type="hidden" name="hdnCmd" value="">
<table border="1" id='tb1'>
<th width="97"> <div align="center">No</div></th>
<th width="97"> <div align="center">Regis</div></th>
<th width="5"> <div align="center">Sup</div></th>
<th width="198"> <div align="center">Check</div></th>
<th width="100"> <div align="center">ROUTE </div></th>
<th width="98"> <div align="center">TRIP</div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<?
if($objResult["ID"] == $_GET["CusID"] and $_GET["Action"] == "Edit")
{
?>
<tr>
<td><div align="center">
<td><input type="text" name="txtEditNo" size="20" value="<?=$objResult["No"];?>"></td>
<input type="text" name="txtEditCustomerID" size="7" value="<?=$objResult["Barcode_th"];?>">
<input type="hidden" name="hdnEditCustomerID" size="5" value="<?=$objResult["ID"];?>">
</div></td>
<td><input type="text" name="txtEditName" size="20" value="<?=$objResult["Name_id"];?>"></td>
<td><input type="text" name="txtEditName1" size="20" value="<?=$objResult["status"];?>"></td>
<td><input type="text" name="txtEditRoute" size="20" value="<?=$objResult["Route"];?>"></td>
<td><div align="center"><input type="text" name="txtEditCountryCode" size="2" value="<?=$objResult["Trip"];?>"></div></td>
<td colspan="2" align="right"><div align="center">
<input name="btnAdd" type="button" id="btnUpdate" value="Update" OnClick="frmMain.hdnCmd.value='Update';frmMain.submit();">
<input name="btnAdd" type="button" id="btnCancel" value="Cancel" OnClick="window.location='<?=$_SERVER["PHP_SELF"];?>';">
</div></td>
</tr>
<?
}
else
{
?>
<tr id='menu2'>
<td><?=$objResult["No"];?></td>
<td><div align="center"><?=$objResult["Barcode_th"];?></div></td>
<td><?=$objResult["Name_id"];?></td>
<td><?=$objResult["status"];?></td>
<td><?=$objResult["Route"];?></td>
<td><div align="center"><?=$objResult["Trip"];?></div></td>
<td align="center"><a href="<?=$_SERVER["PHP_SELF"];?>?Action=Edit&CusID=<?=$objResult["ID"];?>">Edit</a></td>
<td align="center"><a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='<?=$_SERVER["PHP_SELF"];?>?Action=Del&CusID=<?=$objResult["ID"];?>';}">Delete</a></td>
</tr>
<?
}
?>
<?
}
?>
<tr>
<td><div align="center" ><input type="text" name="txtAddNo" size="5"></td>
<td><div align="center" size="10"><input type="text" name="txtAddCustomerID" size="5"></div></td>
<td><input type="text" name="txtAddName" size="20"></td>
<td><input type="text" name="txtAddName1" size="20"></td>
<td><input type="text" name="txtAddEmail" size="20"></td>
<td><div align="center"><input type="text" name="txtAddCountryCode" size="2"></div></td>
<td><input name="btnAdd" type="button" id="btnAdd" value="Add" OnClick="frmMain.hdnCmd.value='Add';frmMain.submit();">
</div></td>
</tr>
</table>
</form>
<?
mysql_close($objConnect);
?>
</body></center>
</html>
|
|
|
|
|
Date :
2013-05-30 22:00:57 |
By :
Manussawin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|