我正在尝试使用页面上的greasemonkey 选择选项。document.getElementById("q10") 返回 null。我确定这与 iframe 有关,但我不知道如何访问它。
这是加载 iframe 的位置。
<td valign="top" height="88%" colspan="2">
<iframe id="initialtextFrame" name="initialtextFrame" title="Survey Questions" frameborder="0" scrolling="auto" style="height: 100%; width: 100%"
src= '/hc/64261160/?cmd=file&file=preChatSurveyContent&site=64261160&sessionkey=H909985739716063515-5531034935655418229K8398902&survey=Pre-Chat'
>This functionality requires frames.To read the LivePerson accessibility policy, please go to the <a href='http://www.liveperson.com/help/accessibility.asp'>Liveperson accessibility policy page</a>.<img src="/hcp/window3/common/trans.gif" width="10" alt="" /></iframe>
</td>
这是我试图在框架内选择的选择选项
<select tabindex="3" name="ude!1841972" id="q10" size="1">
<option id="q10r0" value="" label="" selected='selected'>Select One</option>
<option id="q10r1" value="Chat-Field Tech-Denver Metro" label="Chat-Field Tech-Denver Metro" >Chat-Field Tech-Denver Metro</option>
<option id="q10r2" value="Chat-Field Tech-CO Springs-SLC, UT" label="Chat-Field Tech-CO Springs-SLC, UT" >Chat-Field Tech-CO Springs-SLC, UT</option>
<option id="q10r3" value="Chat-Field Tech-Outstate CO-MT-UT-Wy" label="Chat-Field Tech-Outstate CO-MT-UT-Wy" >Chat-Field Tech-Outstate CO-MT-UT-Wy</option>
</select>
尝试 document.getElementById("q10r3") 和 "q10" 都返回 null