如何打开框架页内的图片链接?
本帖最后由 bjian 于 2014-6-1 14:33 编辑主页代码如下:
<html>
<head>
<title>课件播放</title>
<style>
.jianjie{
font-family: "微软雅黑";
line-height: 20px;
color: #333333;
text-indent: 26px;
font-weight: normal;
}
.tjdj{
font-weight: bold;
color: #990000;
font-size: 14px;
}
</style>
<link href="/elms/css/web.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/elms/js/jquery/jquery-1.4.2.min.js"></script>
<script language='javascript'>
var isfirst = true;
var openWin;
function reload(){
try{
if (window.opener.needReload) {
window.opener.location.reload();
}
}
catch(e){
}
}
//用jquery处理ajax请求 ,加入学习中心
function choose(){
if(confirm("是否将该课件加入到我的学习中心?")){
$.ajax({
type: "post",
url: "selectWebCourse!select.action?courseId="+"null",
data: "",
success: function(responseText){
if (responseText == "success") {
if ("null" == "1") {
alert("课件已成功加入我的学习中心!");
$('#td_select').html("<div align='center' style='height: 23px;'><img src='/elms/images/often/yx.gif' width='49'></div>");
} else {
alert("课件已申请,请等待审批!");
$('#td_select').html("<div align='center' style='height: 23px;'><font color='red' size='2'>等待审批</font></div>");
}
$('#div_select').html("<img src='/elms/images/ww3.png' width='240' border='0'/>");
}
if (responseText == "canNotApply") {
alert("选课失败,已经超过你能选择课件的数量!");
}
}
});
}
}
//显示隐藏菜单项
var TdHide = 1;
function changeWide() {
var a = document.getElementById("imgSign");
var mTd = document.getElementById("menuTd");
if (TdHide == 0) {
mTd.style.display="none";
a.src = "/elms/image/frame/web/sanjiao01.png";
TdHide = 1;
return;
} else {
mTd.style.display="";
a.src = "/elms/image/frame/web/sanjiao.png";
TdHide = 0;
return;
}
}
function showName(){
var courseName = document.getElementById("courseName");
courseName.innerHTML+="<font color='red'></font>";
}
</script>
</head>
<body bgcolor="#FFFFFF" style="margin:0" text="#000000" onunload="reload()" topmargin=0 leftmargin=0 background="">
<!--table border="0" width="950"align="center"cellpadding="0" cellspacing="0" >
<tr>
<td valign="top">
<img src="/elms/images/bg3.gif" >
</td>
</tr>
</table-->
<table width="100%" height="100%" border=0 cellspacing="0" cellpadding="0" align="center" class="table">
<tr>
<td colspan=4 id="courseName" align="center" class="tdbigtitle" style="font-size: 20px;font-family: 微软雅黑;font-weight: bold;"></td>
</tr>
<tr>
<td valign="top" width="240" class="table" id="menuTd" style="display: none;">
<table width="100%" height="100%">
<tr class="trcontent">
<td id="courseInfo"></td>
</tr>
<tr>
<td><div align="center" style="height: 23px;"><font color="red"></font></div></td>
</tr>
<tr><td>
<div id="div_select" style= "position:absolute; left:7px; top:265px; width:240px;">
<img src="/elms/images/ww3.png" width="240" border="0"/>
</div>
</td></tr>
<tr valign="top">
<td align="left" height="100%">
<iframe id="menu" name="menu" src="getAiccLaunchMenu.action?canStudy=true&courseId=xzxy0404&userId=LBbaiyuhu&auId=0" width="100%" height="100%" marginheight=0 frameborder=0 topmargin=0 leftmargin=0 scrolling=auto></iframe>
</td>
</tr>
</table>
</td>
<td>
<table width='6' height="100%" border='0' align="left" cellpadding='0' cellspacing='0'>
<tr>
<td valign="middle" bgcolor="#EAEEF2"><a href="#" onClick="javascript:changeWide();"><img id="imgSign" src="/elms/image/frame/web/sanjiao01.png" border="0" alt="显示/隐藏左框架" title="显示/隐藏左框架" /></a></td>
</tr>
</table>
</td>
<td width="100%" id="ContentCortrolTd" style="display:none">
<iframe id="ContentCortrol" name="ContentCortrol" src="" width="100%" height="100%" marginheight=0 frameborder=0 topmargin=0 leftmargin=0 scrolling="no"></iframe>
</td>
<td height="100%">
<iframe id="content" name="content" src="getAiccWelcome.action?courseId=xzxy0404&userId=LBbaiyuhu" width="100%" height="100%" marginheight=0 frameborder=0 topmargin=0 leftmargin=0 scrolling=auto></iframe>
</td>
</tr>
</table>
</body>
</html>
框架页代码如下:<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="keywords" content="国家行政学院音像出版社,增强忧患意识 提高全面深化改革的自觉性(上)">
<meta http-equiv="description" content="国家行政学院音像出版社,增强忧患意识 提高全面深化改革的自觉性(上)">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>增强忧患意识 提高全面深化改革的自觉性(上)</title>
<script src="Scripts/AICC.js" type="text/javascript"></script>
<link href="Styles/index.css" rel="stylesheet" type="text/css" />
<style type="text/css">
td img {display: block;}.STYLE1 {font-size: 12px}
</style>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p=new Image; d.MM_p.src=a;}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x;if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames.document; n=n.substring(0,p);}
if(!(x=d)&&d.all) x=d.all; for (i=0;!x&&i<d.forms.length;i++) x=d.forms;
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function redir(sFromBegin){
location.href = "XueXi.htm?"+sFromBegin+"video";
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr=x; if(!x.oSrc) x.oSrc=x.src; x.src=a;}
}
//-->
</script>
</head>
<body onLoad="getParam();MM_preloadImages('images/enter-red.gif','images/goon-red.gif')">
<div id="main">
<table border="0" cellpadding="0" cellspacing="0" width="700">
<!-- fwtable fwsrc="index很多人700x475 拷贝.png" fwbase="images.jpg" fwstyle="Dreamweaver" fwdocid = "1231884801" fwnested="0" -->
<tr>
<td><img src="images/spacer.gif" width="165" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="370" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="165" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td><img name="images_r1_c1" src="images/images_r1_c1.jpg" width="165" height="195" border="0" id="images_r1_c1" alt="" /></td>
<td><img name="images_r1_c2" src="images/images_r1_c2.jpg" width="370" height="195" border="0" id="images_r1_c2" alt="" /></td>
<td><img name="images_r1_c3" src="images/images_r1_c3.jpg" width="165" height="195" border="0" id="images_r1_c3" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="195" border="0" alt="" /></td>
</tr>
<tr>
<td><img name="images_r2_c1" src="images/images_r2_c1.jpg" width="165" height="185" border="0" id="images_r2_c1" alt="" /></td>
<td><img name="images_r2_c2" src="images/images_r2_c2.jpg" width="370" height="185" border="0" id="images_r2_c2" alt="" /></td>
<td><img name="images_r2_c3" src="images/images_r2_c3.jpg" width="165" height="185" border="0" id="images_r2_c3" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="185" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF"><table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="myform" id="myform">
<tr>
<td><div align="center"><a href="#" onClick="continuelearn();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1011','','images/goon-red.gif',1)"><img src="images/goon-gray.gif" name="Image1011" border="0" id="Image1011" /></a></div></td>
<td><div align="center"></div></td>
<td><div align="center"><a href="XueXi.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1001','','images/enter-red.gif',1)"><img src="images/enter-gray.gif" name="Image1001" border="0" id="Image1001" /></a></div></td>
</tr>
</form>
</table></td>
<td><img src="images/spacer.gif" width="1" height="73" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="3" valign="top" bgcolor="#FFFFFF"><div align="center" class="STYLE1">国家行政学院音像出版社出品 欢迎访问:中国公务员培训网 <a href="http://www.gwypx.com.cn" target="_blank" class="tip">http://www.gwypx.com.cn</a></div></td>
<td><img src="images/spacer.gif" width="1" height="22" border="0" alt="" /></td>
</tr>
</table>
</div>
</body>
</html>
这个是一个学习的网站,需要点击框架页内的enter-red.gif图片进入课程,我现在代码如下,但进入不了,求求大家帮忙了!!!$oIE1 = _IECreate("http://课程网址")
Sleep(6000)
_IEImgClick ($oForm, "enter-red.gif", "src")这种方法也不行$OK = _IEGetObjByID($oIE1, "Image1001")
$OK.click 或者有没有识别图片中的文字进行点击的,因为不是所有页面的图片都一样,但“进入课程”这几个字是一样的,谢谢了 怎么没人愿意帮忙吗?自己顶一下 没人吗?自己顶一下 这样的网页肯定要登录,你直接_IECreate("http://课程网址"),不可能显示出学习页面的。在网页都打没打开的情况下,还谈什么点击呢?
你给的代码太少了,你的代码问题有点儿大。不知从何帮起啊。 回复 5# shqf
谢谢您的回答,我这个的目的, 简单来说,就是点击框架2内的图片链接 针对已打开的网页,程序必须先用_IEAttach()获取IE浏览器对象,如果你所要点击的图片链接在此网页中的一个框架的话,则需要再用_IEFrameGetObjByName()获取此框架对象,然后才用_IEImgClick点击图片链接。如果_IEImgClick不行的话,要获取元素对象,用其他命令函数进行点击等。 本帖最后由 bjian 于 2014-6-13 16:51 编辑
回复 7# shqf
本人对这个不是太熟悉,方便给个例子吗?谢谢您了
如果方便,能否帮看下这个帖子怎么解决,谢谢
http://www.autoitx.com/forum.php?mod=viewthread&tid=44551&highlight=
页:
[1]