aardio 官方社区

 找回密码
 注册会员

QQ登录

只需一步,快速开始

搜索
查看: 11948|回复: 1

双层框架frame 第2层无name 语法写法

[复制链接]

15

主题

21

回帖

447

积分

二级会员

积分
447
发表于 2018-3-17 01:57:56 | 显示全部楼层 |阅读模式
本帖最后由 ccbwx 于 2018-3-17 02:05 编辑

有3个html文件            
frm2no.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<iframe name="frame11" src="11no.html" width="500" height="500" ></iframe>
</body>
</html>


11no.html frame没有name
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<iframe src="bottom.html" width="400" height="400"></iframe>
</body>
</html>


bottom.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<label>请选择喜欢的汽车名牌
<select name="cars">
<option value="1">Volvo</option>
<option value="2">Saab</option>
<option value="3">Fiat</option>
<option value="4">Audi</option>
</select>
<input type="submit" name="ok" id="ok" value="提交" onclick="alert('成功点击提交按钮!');"/>
</label>
<br>
<form>
First name:<br>
<input type="text" name="firstname">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
<br>
<button type="button" onclick="alert('Hello World!')">告诉我你的名字</button>
<br>
<form action="#" method="get">
  <p><input type="checkbox" name="vehicle" value="Bike" /> I have a bike</p>
  <input type="submit" value="Submit" />
</form>
</body>
</html>



双层 都有name 执行起来没问题,我试了下都可以
/*
        //访问2层框架带有name 的可以正常执行
         import web.form.util;
         web.form.util.crossDomain()
        var wb1 = wb.getWebForm( "frame11" )
        var wb2 = wb1.getWebForm("frame22")
        var ele = wb2.getEle("ok")
        ele.click();
*/


如果11no.html文件中frame 没有name的话,代码改来改去就是出错
        //访问2层框架没name
        var fele = wb.queryEles( src="11no.html" ;tagName="IFRAME" );
        wbFrame = wb.getWebForm(fele);
        ele = wbFrame.getEle("ok")
        ele.click()


        var fele = wb.queryEles( parent="frame11" ;src="bottom.html" );
        wbFrame = wb.getWebForm(fele);
        ele = wbFrame.getEle("ok")
        ele.click()
请教一下!!

15

主题

21

回帖

447

积分

二级会员

积分
447
 楼主| 发表于 2018-3-18 19:18:54 | 显示全部楼层
不停的摸索,不停的测试,终止搞定了{:lol}{:lol}{:lol}{:lol}{:lol}{:lol}{:lol}{:lol}
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

手机版|未经许可严禁引用或转载本站文章|aardio.com|aardio 官方社区 ( 皖ICP备09012014号 )

GMT+8, 2025-1-13 16:05 , Processed in 0.059024 second(s), 22 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表