Thursday, 30 December 2021

PHP#13MySQL#9 - TabsMenu

<!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>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="60" colspan="3">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#FF9933">
    <!--Links used to initiate the sub menus. Pass in the desired submenu index numbers (ie: 0, 1) -->
 <?php
		include("../connect.php");
		$sl1="select idTL, TenTL from theloai";
		$kq1=mysqli_query($link,$sl1);
		$i=0;
		while($d1=mysqli_fetch_array($kq1))
		{ if($i>0){echo " | ";}
		  $i=1;
		?>
		<a href="#" onMouseover="showit(<?php echo $d1['idTL'];?>)"><?php echo $d1['TenTL'];?></a>
	<?php }?>



<br>

<!-- Edit the dimensions of the below, plus background color-->
<ilayer width=400 height=32 name="dep1" bgColor="#E6E6FF">
<layer name="dep2" width=400 height=32>
</layer>
</ilayer>
<div id="describe" style="background-color:#E6E6FF;width:100%;height:20px" onMouseover="clear_delayhide()" onMouseout="resetit(event)"></div>


<script language="JavaScript1.2">

/*
Tabs Menu (mouseover)- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var submenu=new Array()

//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.
<?php
$kq1=mysqli_query($link,$sl1);
while($d1=mysqli_fetch_array($kq1))
	{
?>
submenu[<?php echo $d1['idTL'];?>]='<font size="2" face="Verdana"><b><?php 
	$sl2="select Ten from loaitin where idTL=".$d1['idTL']	;
			$kq2=mysqli_query($link,$sl2);
			while($d2=mysqli_fetch_array($kq2)){
	?> | <a href="#"><?php echo $d2['Ten'];?></a><?php }?></b></font>'
<?php }?>

//Set delay before submenu disappears after mouse moves out of it (in milliseconds)
var delay_hide=500

/////No need to edit beyond here

var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""

function showit(which){
clear_delayhide()
thecontent=(which==-1)? "" : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}

function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout("showit(-1)",delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout("showit(-1)",delay_hide)
}

function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

</script>
</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

0 comments:

Post a Comment