求html购物车代码,,效果如图显示

求html购物车代码,,效果如图显示,第1张

<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 比较方便  有什么不懂得可以问我

html超链接的写法是使用a标签,如:<a href="//www.baidu.com">百度一下,你就知道</a>。

在html中,a标签中的a(或者 A) 是 anchor 的缩写 。anchor的基本解释是锚,这些标签的作用是标明超连接的起始位置或目的位置。

<a>标签可定义锚,通过使用 href 属性。创建指向另外一个文档的链接(或超链接)通过使用 name 或 id 属性,创建一个文档内部的书签。<a>元素最重要的属性是href属性,它指定目标链接。

在所有浏览器中,链接的默认外观是,未被访问的链接带有下划线而且是蓝色的,已被访问的链接带有下划线而且是紫色的,活动链接带有下划线而且是红色的。

扩展资料:

Html中a标签伪类:

1、a:link {color: #FF0000}

未访问的链接样式。

2、a:visited {color: #00FF00}

已访问的链接样式。

3、a:hover {color: #FF00FF}

当有鼠标悬停在链接样式。

4、a:active {color: #0000FF}

被选择的链接样式。

参考资料来源:百度百科-a (HTML语言标签)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/8274815.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存