sharepoint天气预报问题

madgec 2011-06-10 11:52:42
在sharepoint中我引用了如下天气预报代码
<iframe name="weather_inc" src="http://cache.xixik.com.cn/7/dalian/" width="225" height="90" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></td>
有如下问题不知如何解决:
每次一点击代码生成的天气预报画面时,总是链接到此天气预报的页面
而我想要的效果是点击此天气预报画面后不会链接到一个新页面,做不了任何链接
请教各位大虾这个问题该如何解决?
...全文
152 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
madgec 2011-06-30
  • 打赏
  • 举报
回复
两位提供的方法我都试用了,第一种我想的也是用div覆盖掉,但为什么我用上面的没办法覆盖掉呢?
第二种给的javascript刚一打开就弹出来一个对话框,因本人不会写脚本编程所以也不知道要如何更改
我在网上查到了一种方法,和yun_liang1028说的方法大致是一种方法,但是我发现通过浏览器浏览之后完全被图片遮盖住了,都看不到天气预报了,大家有什么好的方法么?
我把网上查的那个页面粘过来,调用265天气预报,不显示链接
http://www.jb51.net/article/5282.htm

1、首先做一个5*5的透明GIF文件,保存在“image”文件夹

2、建一个“weather”HTM文件,代码如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>天气预报</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
document.oncontextmenu=new Function('event.returnValue=false;');
document.onselectstart=new Function('event.returnValue=false;');
//以上是禁止鼠标右键
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body bgcolor="#FFF9EE">
<div id="Layer1" style="position:absolute; width:175px; height:54px; z-index:1; left: 0; top: 0;"><img src="image/weather.gif" alt="天气预报" width="190" height="54"></div>
<iframe src="http://weather.265.com/weather.htm" width="190" height="54" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" name="I1"></iframe>
</body>
</html>

3、调用代码:
<iframe src="weather.htm" width="190" height="54" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>

详细出处参考:http://www.jb51.net/article/5282.htm
继续求解,谢谢!
夏至夕陽 2011-06-10
  • 打赏
  • 举报
回复
刚试了一下,天气预报里的超链接已经固定了,就得通过javascript改,但是因为跨域了,iframe里的东西是不能访问的。

粘上我的代码供楼主参考,搜了一下,好像也可以绕过去。
自己找一找吧

<iframe id="weather_inc" name="weather_inc" src="http://cache.xixik.com.cn/7/dalian/" width="225" height="90" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>

<script language="JavaScript">
var weather_inc = document.getElementById("weather_inc");
function on_weatherload() {
alert(1);
var oIframe = weather_inc;
alert(1);
var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
alert(oDoc.document);
if (oDoc.document) {
oDoc = oDoc.document;
}
alert(1);
var hyperlinks = oDoc.document.getElementsByTagName("a");
alert(hyperlinks.length);
if (hyperlinks) {
for (var i = 0; i < hyperlinks.length; i++) {
hyperlinks[i].target = "_self";
}
}
}

weather_inc.onload = on_weatherload;
</script>
Oo云 2011-06-10
  • 打赏
  • 举报
回复
<html>
<body>
<div style="width:225px;height:100px;z-index:100;background:#000;position:absolute;left:0;top:0;filter:alpha(opacity=0);-moz-opacity:0;"></div>
<iframe name="weather_inc" src="http://cache.xixik.com.cn/7/dalian/" width="225" height="90" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</body>
</html>

我觉得可以用div 来覆盖掉
这个要放在sharepoint页面上的时候 div的位置要调整 才能盖上,
你先单独运行一下上面的程序

3,245

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 SharePoint
社区管理员
  • SharePoint社区
  • 霖雨 - LinyuLoveTJ
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧