使用jS代码循环添加tr

戈菲 戈菲 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1<---strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="cache-control" content="max-age=5"/>
</head>
<body>
<!-- start header -->
<style type="text/css">
td{text-align:center;border-style:solid;border-width:1px 1px 1px 1px;}
img{border-style:solid;border-width:1px 1px 1px 1px;}
p{text-align:center;}
</style>
<table align="center">
<tr>
<td>
<img id="image" src="http://192.168.8.1/photo/ch0.jpg?r=Saturday July 31 14:10:27 2013" width="283" height="230"/>
<br>192.168.8.01</br>
</td>
<td>
<img id="image" src="http://192.168.8.1/photo/ch1.jpg?r=Saturday July 31 14:10:27 2013" width="283" height="230"/>
<br>192.168.8.01</br>
</td>
<td>
<img id="image" src="http://192.168.8.1/photo/ch2.jpg?r=Saturday July 31 14:10:27 2013" width="283" height="230"/>
<br>192.168.8.01</br>
</td>
<td>
<img id="image" src="http://192.168.8.1/photo/ch3.jpg?r=Saturday July 31 14:10:27 2013" width="283" height="230"/>
<br>192.168.8.01</br>
</td>
</tr>
<tr>
<td>
<img id="image" src="http://192.168.8.2/photo/ch0.jpg?r=Saturday July 31 14:10:27 2013" width="283" height="230"/>
<br>192.168.8.02</br>
</td>
<td>
<img id="image" src="http://192.168.8.2/photo/ch1.jpg?r=Saturday July 31 14:10:27 2013" width="283" height="230"/>
<br>192.168.8.02</br>
</td>
<td>
<img id="image" src="http://192.168.8.2/photo/ch2.jpg?r=Saturday July 31 14:10:27 2013" width="283" height="230"/>
<br>192.168.8.02</br>
</td>
<td>
<img id="image" src="http://192.168.8.2/photo/ch3.jpg?r=Saturday July 31 14:10:27 2013" width="283" height="230"/>
<br>192.168.8.02</br>
</td>
</tr>
</table>
</body>
</html>


如代码所示:
要求:使用JS向网页添加table里的tr标签,并且 src的地址根据IP地址192.168.8.1逐一递增 最多200;
如果在网页中添加一个文本框输入需要添加到的IP是多少个,能实现么;
在更改src链接中的IP地址时,同时也需要更改这个tr中br的IP地址。
请各路大神帮忙看下,应该如何来解决这个问题。
...全文
评论 8
收藏 已收藏
分享
返回顶部
戈菲
JavaScript 87,983 成员 224,680 内容