[英]how do you reference this html object in javascript? applescript
I want to reference these two buttons, but am unsure how to reference them to click them. 我想引用这两个按钮,但是不确定如何引用它们以单击它们。
I found this statement: 我发现此语句:
do JavaScript document.forms[0]['btnI'].click()
in front document 在前面的文档中执行JavaScript document.forms[0]['btnI'].click()
and want to change it reference this: 并要更改它引用此:
<li id="app_114228431971868" class="114228431971868">
<div>
<img class="gameimg" src="http://photos-g.ak.fbcdn.net/photos-ak-snc1/v27562/200/114228431971868/app_1_114228431971868_5955.gif" width="75" height="75">
</div>
<p>Knights of the Crystals</p>
</li>
Then I want to add a second command to press this button: 然后,我想添加第二个命令来按下此按钮:
<div id="get-button"></div>
Then a third to reference this button: 然后三分之一引用此按钮:
<img width="125" height="50" alt="Ready!" src="http://gffstatic.oneringgame.com/images/btn-ready.png" id="ggg-readybut" style="display: inline; ">
I think you put the id where the btnI is in the javascript, but am unsure what to do for the other parts of the line. 我认为您将ID放在javascript中btnI的位置,但是不确定该行的其他部分应该做什么。
To reference a DOM element by ID: 要通过ID引用DOM元素:
document.getElementById("theid");
So: 所以:
document.getElementById("get-button").click()
And: 和:
document.getElementById("ggg-readybut") //reference to the image element
open location "http://apps.facebook.com/gfriendfinder/?ref=bookmarks&count=0"
delay 5
activate application "Safari"
do JavaScript "document.getElementById("app_114228431971868");"
do JavaScript "document.getElementById("app_114228431971868").click()"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.