如何使用javascript从object标签读取参数值 [英] How to read the param value from the object tag using javascript

查看:211
本文介绍了如何使用javascript从object标签读取参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < object id =myidclass =newclass > 
< param name =bgcolorvalue =#FFFFFF/>
< param name =widthvalue =345/>
< param name =heightvalue =216/>
< param name =playerIDvalue =1234/>
< param name =playerKeyvalue =AFASS/>
< param name =isVidvalue =true/>
< param name =isUIvalue =true/>
< / object>


解决方案

或者,您可以尝试以下语句。它会返回页面上的所有播放ID,如果你有多个。

  var playerIDs = document.getElementsByName('playerID' ); 

playerIDs将是一个数组。如果你在页面上只有一个playerID,你可以说 playerIDs [0]


Is it possible to read the playerID value using JavaScript?

<object id="myid" class="newclass">
  <param name="bgcolor" value="#FFFFFF" />
  <param name="width" value="345" />
  <param name="height" value="216" />
  <param name="playerID" value="1234" />
  <param name="playerKey" value="AFASS" />
  <param name="isVid" value="true" />
  <param name="isUI" value="true" />
</object>

解决方案

Or, you can try the following statement. It will return all the play IDs on the page, if you have multiple.

var playerIDs = document.getElementsByName('playerID');

playerIDs will be an array. If you only have one playerID on the page, you can just say playerIDs[0]

这篇关于如何使用javascript从object标签读取参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆