解决方案 »
- 表格表头不动tbody区域可用滚动条滚动问题..?
- 如何隐藏alert事件
- 急问:请问如何取得当前页面所有HIDDEN元素?
- ~~~~~~~~~~~~~请教一个window.showModalDialog的问题,非常感谢~~~~~~~~~~~
- 循环判断文本框
- document.getElementById取值错误
- 如何用javascript实现打印机属性设置
- Baidu特别为四有新人提供了网站截图功能吗?
- 请问用window.print()打印有没有办法去掉下面的页码和日期
- 大侠们,有没有各种Javascript方法的使用参考说明,谢谢了先
- 这个JS不能兼容火狐,请高手帮助...
- 怎么获取Cookie的有效期
把<iframe src="http://m.weather.com.cn/m/pn1/weather.htm " width="235" height="16" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>
的src去掉
在window.onload = function() {
var c = document.getElementById('controller').getElementsByTagName('td');
var ar = ['http://www.baidu.com/s', 'http:m.baidu.com/m'];
for(var i = 0; i < c.length; i ++) {
c[i].onclick = function() {
c[0].style.backgroundColor = '#FFF';
c[1].style.backgroundColor = '#FFF';
c[this.cellIndex].style.backgroundColor = '#0FF';
document.getElementById('searcher').action = ar[this.cellIndex];
}
}
}
中设置iframe的src
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
//这样试试
function changeSearcher(obj) {
var c = document.getElementById('controller').getElementsByTagName('td');
var ar = ['http://www.baidu.com/s', 'http://mp3.baidu.com/m'];
for(var i = 0; i < c.length; i ++) c[i].style.backgroundColor = '#FFF';
c[obj.cellIndex].style.backgroundColor = '#0FF';
document.getElementById('searcher').action = ar[obj.cellIndex];
}
</script>
</head><body>
<table>
<tr align="center" id="controller">
<td style="background-color:#0FF" onclick="changeSearcher(this);"><a href="javascript:void(0);">网页</a></td>
<td onclick="changeSearcher(this);"><a href="javascript:void(0);">音乐</a></td>
</tr>
<tr>
<td colspan="2">
<form action="http://www.baidu.com/s" target="_blank" id="searcher">
<input name="word" type="text" value="" />
<input type="submit" value="百度一下" />
</form></td>
</tr>
</table>
天气预报:
<iframe src="http://m.weather.com.cn/m/pn1/weather.htm " width="235" height="16" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>
</body>
</html>
解决了一部分问题,但是遇到weather.htm打开速度极慢时,整个网页的链接都无法点击。
谢谢二位!