1: 2: 3: 4: 5: |
<script type='text/javascript'> <!-- window.onresize = myOnResize; --> </script> |
1: 2: 3: 4: |
<body onload='myOnLoad()'> <div id='idFlashLayer' style="position:absolute; top:0;left:0;"> <SCRIPT type="text/javascript">putFlash();</SCRIPT> </div> |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: |
var nParamInterval = 10; var strIdFlashLayer = 'idFlashLayer'; var nIdInterval0 = 0; var nIdInterval1 = 0; var strBrowser = ''; function myOnLoad(){ strBrowser = checkBrowser(); myOnResize(); } function myOnResize() { var objLayer = document.getElementById(strIdFlashLayer); objLayer.style.width = document.documentElement.clientWidth + 'px'; objLayer.style.height = document.documentElement.clientHeight + 'px'; if(!nIdInterval0)nInterval0 = setInterval('myIntervalFunc0()',nParamInterval); } function checkBrowser(){ var strAgent = navigator.userAgent; if(strAgent.indexOf("Opera") != -1)return 'opera'; if(strAgent.indexOf("Chrome") != -1)return 'chrome'; if(strAgent.indexOf("MSIE") != -1)return 'ie'; if(strAgent.indexOf("Firefox") != -1)return 'firefox'; if(strAgent.indexOf("Netscape") != -1)return 'netscape'; if(strAgent.indexOf("Safari") != -1)return 'safari'; } function myIntervalFunc0(){ clearInterval(nIdInterval0); nIdInterval0 = false; var nScrollWidth = parseInt(document.documentElement.scrollWidth); var nScrollHeight = parseInt(document.documentElement.scrollHeight); if(strBrowser == 'firefox'){ resizeFlash(nScrollWidth,nScrollHeight); }else if(strBrowser == 'safari' || strBrowser == 'chrome'){ nScrollWidth = document.body.scrollWidth; nScrollHeight = document.body.scrollHeight; var nWidthNew,nHeightNew; var nClientWidth = document.documentElement.clientWidth; var nClientHeight = document.documentElement.clientHeight; if(nClientWidth < nScrollWidth)nWidthNew = nScrollWidth; else nWidthNew = nClientWidth; if(nClientHeight < nScrollHeight)nHeightNew = nScrollHeight; else nHeightNew = nClientHeight; resizeFlash(nWidthNew,nHeightNew); }else{//ie and else resizeFlash(nScrollWidth - 5,nScrollHeight - 5); if(!nIdInterval1)nInterval1 = setInterval('myIntervalFunc1()',nParamInterval); } } function myIntervalFunc1(){ clearInterval(nIdInterval1); nIdInterval1 = false; var nScrollWidth = document.documentElement.scrollWidth; var nScrollHeight = document.documentElement.scrollHeight; resizeFlash(nScrollWidth,nScrollHeight); } function resizeFlash(nWidth,nHeight){ var objLayer = document.getElementById(strIdFlashLayer); objLayer.style.width = nWidth + 'px'; objLayer.style.height = nHeight + 'px'; } function putFlash(){ var widthSwf = "100%"; var heightSwf = "100%"; var filenameSwf = './testFlash.swf'; var nameEmbed = 'testFlash'; var strIdFlash = 'flash'; var nBgColor = '#ffffff'; var strObject = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; strObject += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab#version=7,0,0,0" '; strObject += 'width="' + widthSwf + '" '; strObject += 'height="' + heightSwf + '" '; strObject += 'id="' + strIdFlash + '" '; strObject += 'name="' + nameEmbed + '" '; strObject += 'align="middle">'; strObject += '<param name="allowScriptAccess" value="sameDomain" />'; strObject += '<param name="movie" value="' + filenameSwf + '" />'; strObject += '<param name="quality" value="high" />'; strObject += '<param name="wmode" value="transparent" />'; strObject += '<param name="scale" value="noscale" />'; strObject += '<param name="bgcolor" value="' + nBgColor + '" />'; strObject += '<embed src="' + filenameSwf + '" '; strObject += 'quality="high" bgcolor="' + nBgColor + '" '; strObject += 'width="' + widthSwf + '" '; strObject += 'height="' + heightSwf + '" '; strObject += 'name="' + nameEmbed + '" '; strObject += 'wmode="transparent" '; strObject += 'scale="noscale" '; strObject += 'id="' + strIdFlash + '" '; strObject += 'align="middle" '; strObject += 'allowScriptAccess="sameDomain" '; strObject += 'type="application/x-shockwave-flash" '; strObject += 'pluginspage="http://www.macromedia.com/go/getflashplayer" '; strObject += '/></object>'; document.write(strObject); } |