
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
#box{
width: 600px
height: auto
}
h1{
width: 100%
height: 100px
line-height: 100px
text-align: center
background: blue
font-size: 50px
margin: 0
color: white
}
p{
background: #9f9285
font-family: "Microsoft YaHei"
font-size: 16px
line-height: 30px
text-indent: 2em
text-align: justify
border-top: 6px solid orange
margin: 0
padding: 10px
}
span{
font-size: 20px
color: blue
text-decoration: underline
}
</style>
</head>
<body>
<div id="box">
<p><span>互联网</span>提供了无限延伸的展示空间,可以容纳无限的商品及内容。在网络鞋城,消费者无论是购物还是查询,都不受时间和地域的任何限制。在消费者享受<span>“鼠标轻轻一点,精品尽在眼前”</span>的背后,是网络鞋城耗时5年修建的物流体系,全国库房面积达到5万平方米,提供货到付款服务的城市超过<span>350</span>个,并为联营上午开通货到付款服务</p>
</div>
</body>
</html>
请采纳,谢谢
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html charset=gb2312" />
<title>修改订单</title>
<style type="text/css">
body{
font-size:13px
line-height:25px
}
table{
border-top: 1px solid #333
border-left: 1px solid #333
width:400px
}
td{
border-right: 1px solid #333
border-bottom: 1px solid #333
text-align:center
}
.title{
font-weight:bold
background-color: #cccccc
}
input text{
width:100px
}
</style>
<script type="text/javascript">
function addRow(){
//行的长度
var rowlength=document.getElementById("order").rows.length
//得到整个表格对象
var order = document.getElementById("order").insertRow(rowlength-1)
order.id=rowlength-1
//插入列
var cel1=order.insertCell(0).innerHTML="游戏光盘"
var cel2=order.insertCell(1).innerHTML="34"
var cel3=order.insertCell(2).innerHTML="&yen58.40"
var cel4=order.insertCell(3).innerHTML="<input type=\"button\"value=\"删除\" onclick=\"delRow('"+(rowlength-1)+"')\"/>"+ "<input type=\"button\"value=\"修改\" onclick=\"editRow('"+(rowlength-1)+"')\"/>"
}
function delRow(qwe){
var ewq=document.getElementById(qwe).rowIndex
document.getElementById("order").deleteRow(ewq)
}
function editRow(rowID){
var row=document.getElementById(rowID)
var cel=row.cells
var text=cel[1].innerHTML
cel[1].innerHTML="<input type='text' value='"+text+"' style='width:40px'>"
cel[3].lastChild.value="确定"
cel[3].lastChild.setAttribute("onclick","update('"+rowID+"')")
}
function update(qwe){
var row=document.getElementById(qwe)
var cel=row.cells
var text=cel[1].lastChild.value
cel[1].innerHTML=text
cel[3].lastChild.value="修改"
cel[3].lastChild.setAttribute("onclick","editRow('"+qwe+"')")
}
/*
function add(){
var a = document.getElementById("order").rows.length
var b = document.getElementById("order").insertRow(a-1)
var one1 = b.insertCell(0).innerHTML="123"
}
*/
</script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" id="order">
<tr class="title">
<td>商品名称</td>
<td>数量</td>
<td>价格</td>
<td> *** 作</td>
</tr>
<tr id="1">
<td>防滑真皮休闲鞋</td>
<td>12</td>
<td>&yen568.50</td>
<td><input name="rowdel" type="button" value="删除" onclick='delRow("1")' />
<input id="edit1" type="button" value="修改" onclick='editRow("1")' /></td>
</tr>
<tr>
<td colspan="4" style="height:30px">
<input name="addOrder" type="button" value="增加订单" onclick="addRow()" /></td>
</tr>
</table>
</body>
</html>
这个是我原来上学的时候练习的代码,练习的是基础的jsDOM *** 作,不过建议以后用Jquery 比较方便 有什么不懂得可以问我
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)