iphonex 虚拟定位
为了清晰起见,下面用最简单的HTML和JavaScript来说明。有这么一段HTML(head部分是标准的head,doctype使用xhtml-transitional的DTD):
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="100%" height="100%">
<param name="movie" value="Test.swf" />
<param name="quality" value="high" />
<embed src="Test.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100%" height="100%"></embed>
</object>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="100%" height="100%">
<param name="movie" value="Test.swf" />
<param name="quality" value="high" />
<embed src="Test.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100%" height="100%"></embed>
</body>
</object>
现在,我们分别用两种方式来获取第一个object(swf)的param参数个数:
var o = document.getElementsByTagName('object')[0];
alert(o.getElementsByTagName('param').length);
alert(o.childNodes.length);
猜猜结果分别是什么?还有,再猜猜o.innerHTML是什么?大家可以自己试试。上面的结果分别是4和2,是不是很诡异? iphonex 虚拟定位
复制代码 代码如下:
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="100%" height="100%">
<param name="movie" value="Test.swf" />
<param name="quality" value="high" />
<embed src="Test.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100%" height="100%"></embed>
</object>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="100%" height="100%">
<param name="movie" value="Test.swf" />
<param name="quality" value="high" />
<embed src="Test.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100%" height="100%"></embed>
</body>
</object>
现在,我们分别用两种方式来获取第一个object(swf)的param参数个数:
复制代码 代码如下:
var o = document.getElementsByTagName('object')[0];
alert(o.getElementsByTagName('param').length);
alert(o.childNodes.length);
猜猜结果分别是什么?还有,再猜猜o.innerHTML是什么?大家可以自己试试。上面的结果分别是4和2,是不是很诡异? iphonex 虚拟定位