主题:让B/S结构的程序也全屏运行
之前做一个触摸屏应用系统要让HTML页全屏显示。
现在把这段主要的代码分享给大家。
触摸屏系统全屏程序:
<!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>全屏显示网页</title> </head> <body> <div id="popupWindow" style=" display:none;" > <table width="60%" style="top:20%; position:absolute; right:20%;border-collapse:collapse;"> <tr> <td colspan="6" align="right"> <input type="button" onclick="parent.upd();" value=" 事 件 " /> 系统界面风格一 可选色</td> </tr> <tr> <td class="color_A"></td> <td class="color_B"></td> <td class="color_F"></td> <td class="color_D"></td> <td class="color_E"></td> <td class="color_C"></td> </tr> <tr> <td>#E3F1FB</td> <td>#C1DBFC</td> <td>#ACD0EE</td> <td>#EFEFEF</td> <td>#F7F7F7</td> <td id="Test_A">#273F7B</td> </tr> </table> </div> <script type="text/javascript"> //获取全屏中的对象 function $(id) { return oPopup.document.getElementById(id); } //创建一个弹出窗口 var createPopupWindow=function(){ oPopup = window.createPopup(); oPopup.document.createStyleSheet().addImport("c.css"); var opBody=oPopup.document.body; opBody.innerHTML =popupWindow.innerHTML; } createPopupWindow(); //全屏显示弹出窗口 var showPopup=function(){ if(oPopup.isOpen)return; var w=screen.width,h=screen.height;//w=1024 h=768 var x=0,y=0; oPopup.show(x,y,w,h); } document.createStyleSheet().addImport("c.css");//导入样式 setInterval(showPopup,50000);//每50秒检查全屏页是否显示 window.onfocus=function(){showPopup();} window.onblur=function(){showPopup();} window.onblur(); /**以下为全屏页面的函数 ****/ var upd=function(){ $("Test_A").innerHTML+="执行函数,"; } </script> </body> </html>
@charset "utf-8"; /* CSS Document */ *{font-size:12px; color:#D49FFF; } body{background-color:#FFF} .color_A{background-color:#E3F1FB;height:25px; } .color_B{background-color:#C1DBFC} .color_C{background-color:#273F7B} .color_D{background-color:#EFEFEF} .color_E{background-color:#F7F7F7} .color_F{background-color:#ACD0EE}
版权声明:本文为host-2008原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。