Line 10: | Line 10: | ||
<link href="https://2017.igem.org/Team:CIEI-China/css/bootstrap?action=raw&ctype=text/css" rel="stylesheet"> | <link href="https://2017.igem.org/Team:CIEI-China/css/bootstrap?action=raw&ctype=text/css" rel="stylesheet"> | ||
<script src="https://2017.igem.org/Team:CIEI-China/js/bootstrap?action=raw&ctype=text/javascript"></script> | <script src="https://2017.igem.org/Team:CIEI-China/js/bootstrap?action=raw&ctype=text/javascript"></script> | ||
− | + | <script type="text/javascript"> | |
+ | < !-- | ||
+ | var winWidth = 0; | ||
+ | var winHeight = 0; | ||
+ | function findDimensions() //函数:获取尺寸 | ||
+ | { | ||
+ | //获取窗口宽度 | ||
+ | if (window.innerWidth) winWidth = window.innerWidth; | ||
+ | else if ((document.body) && (document.body.clientWidth)) winWidth = document.body.clientWidth; | ||
+ | //获取窗口高度 | ||
+ | if (window.innerHeight) winHeight = window.innerHeight; | ||
+ | else if ((document.body) && (document.body.clientHeight)) winHeight = document.body.clientHeight; | ||
+ | //通过深入Document内部对body进行检测,获取窗口大小 | ||
+ | if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) { | ||
+ | winHeight = document.documentElement.clientHeight; | ||
+ | winWidth = document.documentElement.clientWidth; | ||
+ | } | ||
+ | //结果输出至两个文本框 | ||
+ | document.form1.availHeight.value = winHeight; | ||
+ | document.form1.availWidth.value = winWidth; | ||
+ | } | ||
+ | findDimensions(); | ||
+ | //调用函数,获取数值 | ||
+ | window.onresize = findDimensions; | ||
+ | //--> | ||
+ | </script> | ||
<style> | <style> | ||
#myleft{ | #myleft{ | ||
Line 34: | Line 59: | ||
padding-right: 30px; | padding-right: 30px; | ||
display: block; | display: block; | ||
− | width: | + | width: winWidth; |
} | } | ||
Revision as of 13:17, 3 October 2017