วันเสาร์ที่ 28 กรกฎาคม พ.ศ. 2561

เขียน PHP ตรวจสอบขนาดหน้าจอเพื่อ ตั้งค่า Height ของ IFRAME

เขียน PHP ตรวจสอบขนาดหน้าจอเพื่อ ตั้งค่า Height ของ IFRAME ให้ดูสวยงาม

if(!isset($_GET['screen_check']))
{
 /* This code will be executed if screen resolution has not been detected.*/
 echo "<script language='JavaScript'>
 <!--
 document.location=\"$PHP_SELF?screen_check=done&Width=\"+screen.width+\"&Height=\"+screen.height;
 //-->
 </script>";
}

ส่วนของ Iframe // ขนาดหน้าจอ 1920*1080  ค่าที่เหมาะสม ให้ลบดู (-270)

<iframe src="show1.php" width="100%"  height="<?=$_GET['Height']-270;?>" id = "myiframe" name="myiframe" marginwidth="5" marginheight="5" frameborder="2" id="myiframe" >
    </iframe>