购物网页html代码(html购物页面代码)
购物网址尾部为html的是什么意思
html是超文本标记语言,尾部为html 你可以理解为你浏览器从服务器那边获取到扩展名为.html的文件(如果想了解html的基础可以去w3cschool 学习下哈)
怎么用html做购物网站
只用eclipse就可以了,用jsp可以写一个js监听事件,购买肯定是一个按钮,在上面添加onclick事件,绑定一个函数,显示购物车这个div或者页面(放在当前页面上面),结算时就是拿商品的价格相加显示出来,比如商品对象放在一个链表里,取出购物车 里的,价格相加。
使用HTML完成下图显示页面,求大神给代码。。
!DOCTYPE
html?lang="en"
head
meta?charset="UTF-8"
titleDocument/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"
h1网络鞋城经营模式简介/h1
pspan互联网/span提供了无限延伸的展示空间,可以容纳无限的商品及内容。在网络鞋城,消费者无论是购物还是查询,都不受时间和地域的任何限制。在消费者享受span“鼠标轻轻一点,精品尽在眼前”/span的背后,是网络鞋城耗时5年修建的物流体系,全国库房面积达到5万平方米,提供货到付款服务的城市超过span350/span个,并为联营上午开通货到付款服务/p
/div
/body
/html
请采纳,谢谢
求html购物车代码,,效果如图显示
html?xmlns=""????
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="yen;58.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????
???td12/td????
???tdyen;568.50/td????
???tdinput?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代码的使用方法
一、基本框架
如同人一样,网页也包括了“头部”和“身体”,
<head>标记内包含着诸如网页标题、语言编码、网页描述等基本信息,而平时我们真正见到的网页内容均放在<body>标记内。现在先介绍一下<head>里的基本信息。
网页标题(标记格式为<title></title>)
创建网页标题文字:<title>标题</title> //此处书写的文字会显示在IE的标题栏上。
网页文档信息(标记格式为<meta>)
描述网页内容类型:<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> //该页面为TXT文本或HTML格式,语言编码方式为GB2312(即简体中文)。
描述网页的关键字信息:<meta name="keywords" content="这里是关键字">
对网页的详细描述:<meta name="description" content="这里是对该网页的介绍">
刷新网页:<meta http-equiv="refresh" content="5;URL=xxx.htm"> //5秒种后刷新,并链接到xxx.htm。
二、组成要素
无论网页如何千变万化,构成一个网页内容的最基本要素大体只有五种,即文字、图片、表格、超链接和表单控件,所以下面将围绕着这五个要素逐一列举介绍。
文字(标记格式为<font></font>)
指定文字字体:<font face="宋体">宋体文字</font>
指定文字大小:<font size="3">3号文字</font>
指定文字颜色:<font color="#FF0000">红色文字</font> //网页颜色采用16位编码,因此#FF0000表现为红色。大家可以查阅相关资料了解其他颜色的编码。
图片(标记格式为<img>)
<img src="images/pic.jpg" width="400" height="300" border="2" align="center">// src指定为路径地址,width为宽度,height为高度,border为边框大小,align为横向位置。
表格(标记格式为<table><tr><td></td></tr></table>)
<table width="400" height="300" border="1" align="center" cellpadding="2" cellspacing="2" bgcolor="#FF0000"><tr><td>此处添加文字或图片等</td></tr></table>// width、height、border、align与以上的例子作用一样,cellpadding为边框与单元格的间距,cellspacing为单元格之间的间距,bgcolor为表格背景色。
以上所介绍的元素都是只存在当前页中,而网页超链接的出现大大改变了人们的浏览习惯,可根据自己喜好,点击到相关链接查看网页信息。
超链接(标记格式为<a></a>)
<a href="xxx.htm" title="提示文字">链接文字或图片</a> //href为被点击后的链接页,title为鼠标悬停在链接文字或图片上后出现的提示文字。
表单控件(标记符号为<input>、<textarea></textarea>、<select></select>)
表单控件实现了人与网页的交互,像大家常去的论坛、购物站点等都有它的“身影”。
文本框:<input type="text" value="这是文本框"> //value为该控件的值,以下每个表单控件均可设定,不设默认为空
密码框:<input type="password">
单选框:<input type="radio">
复选框:<input type="check">
提交按钮:<input type="submit">
重置按钮:<input type="reset">
隐藏区域:<input type="hidden">
文本域:<textarea rows="6" cols="30"></textarea> //rows为行数,cols为宽度
列表框:<select><option>项目1<option>项目2<option>项目3</select>
编后:学习HTML的目的不是为了要用它来编写网页,因为利用很多软件的编辑功能就可以省掉一些编程的麻烦。最重要的是本文介绍了页面里最基本的元素,了解这些知识后可以分析网页的结构,学习高手们所使用的特殊效果。当然HTML代码的内容远不止这些,想要在网页设计方面发展的朋友学好它是非常必要的。
jsp网上购物代码及操作!
1.index.jsp登陆界面:
%@ page language="java" import="java.util.*" pageEncoding="GB2312"%
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%
%session.invalidate();% %--销毁所有session对象--%
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
base href="%=basePath%"
title购物车/title
meta http-equiv="pragma" content="no-cache"
meta http-equiv="cache-control" content="no-cache"
meta http-equiv="expires" content="0"
meta http-equiv="keywords" content="keyword1,keyword2,keyword3"
meta http-equiv="description" content="This is my page"
!--
link rel="stylesheet" type="text/css" href="styles.css"
--
/head
body
center
hr
请输入用户名,默认的为Guest
form action="checklogin.jsp" mothod=get
table width="40%" border="1"
tr bgcolor="#336600"
tddiv align="center"font color="FFFFFF"用户登陆/font/div/td
/tr
tr align="center" bgcolor="#CCCCCC"
td用户名:input type="password" name="userID"/td
/tr
tr align="center" bgcolor="#CCCCCC"
td口??令:input type="password" name="password"/td
/tr
tr align="center" bgcolor="#CCCCCC"
tdinput type="submit" value="登陆"/td
/tr
/table
/form
/center
/body
/html
2.checklogin.jsp登陆认证页面:
%@ page language="java" import="java.util.*" pageEncoding="GB2312"%
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%
jsp:useBean id="Car" class="web.Car" scope="session"
jsp:setProperty property="*" name="Car"/
/jsp:useBean
%session.setMaxInactiveInterval(900); % %--设置session超时为30分--%
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
base href="%=basePath%"
titleMy JSP 'checklogin.jsp' starting page/title
meta http-equiv="pragma" content="no-cache"
meta http-equiv="cache-control" content="no-cache"
meta http-equiv="expires" content="0"
meta http-equiv="keywords" content="keyword1,keyword2,keyword3"
meta http-equiv="description" content="This is my page"
!--
link rel="stylesheet" type="text/css" href="styles.css"
--
/head
body
%
String nextpage;
if(Car.getUserID().equals("Guest"))
nextpage="car.jsp";
else
nextpage="index.jsp";
%
jsp:forward page="%=nextpage%"/jsp:forward
/body
/html
3.car.jsp购物车页面
%@ page language="java" import="java.util.*" pageEncoding="GB2312"%
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%
%@ page import="java.util.*" %
%@ page import="web.Car" %
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
base href="%=basePath%"
title购物车/title
meta http-equiv="pragma" content="no-cache"
meta http-equiv="cache-control" content="no-cache"
meta http-equiv="expires" content="0"
meta http-equiv="keywords" content="keyword1,keyword2,keyword3"
meta http-equiv="description" content="This is my page"
!--
link rel="stylesheet" type="text/css" href="styles.css"
--
/head
body
br%@ include file="header.jsp" %
hr
font size="2"
jsp:useBean id="Car" class="web.Car" scope="session"
/jsp:useBean
pfont color="#804040" face="楷体_GB2312"
strong百货商场,请尽情的选购商品添加到购物车!/strong
/font
%String str=response.encodeRedirectURL("add.jsp"); %
form action="%=str %" method="post" name="form"
select name="item" value="没选择"
option value="TV"电视机/option
option value="apple"苹果/option
option value="coke"可口可乐/option
option value="milk"牛奶/option
option value="tea"茶叶/option
/select
pfont color="#804040" face="楷体_GB2312"
输入购买的数量:
/font
input type="text" name="mount"
p
input type="radio" name="unit" value="个"个
input type="radio" name="unit" value="公斤"公斤
input type="radio" name="unit" value="台"台
input type="radio" name="unit" value="瓶"瓶p
input type="submit" value="提交添加"
/form
pfont color="#804040" face="楷体_GB2312"你的购物车里有如下商品:/font
font color="#FF8040" size="2"
%
Hashtable list=Car.list_h();
Enumeration enums=list.elements();
while(enums.hasMoreElements()){
String goods=(String) enums.nextElement();
byte b[]=goods.getBytes("ISO-8859-1");
goods=new String(b);
out.println("br"+goods);
}
%
/font
% String strl=response.encodeRedirectURL("selectRemoveGoods.jsp");%
form action="%=strl %" method="post" name="form"
input type="submit" value="修改购物车中的商品"
/form
/font
%@ include file="tail.jsp" %
/body
/html
4.add.jsp 增加物品:
%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
base href="%=basePath%"
title购物车/title
meta http-equiv="pragma" content="no-cache"
meta http-equiv="cache-control" content="no-cache"
meta http-equiv="expires" content="0"
meta http-equiv="keywords" content="keyword1,keyword2,keyword3"
meta http-equiv="description" content="This is my page"
!--
link rel="stylesheet" type="text/css" href="styles.css"
--
/head
body
%@ include file="header.jsp" %
hr
font size="2"
jsp:useBean id="Car" class="web.Car" scope="session"/jsp:useBeanbr
jsp:setProperty name="Car" property="*"/
%Car.add_h();%
font face="楷体_GB2312"
font color="#FF8040" size="2"
p您的购物车有如下商品:
%
Hashtable list=Car.list_h();
Enumeration enums=list.elements();
while(enums.hasMoreElements()){
String goods=(String) enums.nextElement();
byte b[]=goods.getBytes("ISO-8859-1");
goods=new String(b);
out.println("br"+goods);
}
%
/font
%String str=response.encodeRedirectURL("car.jsp"); %
br
form action="%=str %" method="post" neme="form"
input type="submit" value="继续购物"
/form
%String strl=response.encodeRedirectURL("selectRemoveGoods.jsp"); %
br
form action="%=strl %" method="post" neme="form"
input type="submit" value="修改购物车中的物品"
/form
/font
/font
%@ include file="tail.jsp"%
/body
/html
5.selectRemoveGoods.jsp选择删除商品:
%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%
%@ page import="java.util.*" %
%@ page import="web.Car" %
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
base href="%=basePath%"
title购物/title
meta http-equiv="pragma" content="no-cache"
meta http-equiv="cache-control" content="no-cache"
meta http-equiv="expires" content="0"
meta http-equiv="keywords" content="keyword1,keyword2,keyword3"
meta http-equiv="description" content="This is my page"
!--
link rel="stylesheet" type="text/css" href="styles.css"
--
/head
body
br%@ include file="header.jsp" %
hr
jsp:useBean id="Car" class="web.Car" scope="session"
/jsp:useBeanbr
p选择从购物车中删除的物品:
%String str=response.encodeRedirectURL("removeWork.jsp"); %
form action="%=str %" method="post" name="form"
select name="deleteitem" size="1"
option value="TV"电视机/option
option value="apple"苹果/option
option value="coke"可口可乐/option
option value="milk"牛奶/option
option value="tea"茶叶/option
/select
input type="submit" value="提交删除"
/form
font face="楷体_GB2312"
font color="#FF8040" size="2"
p您的购物车有如下商品:
%
Hashtable list=Car.list_h();
Enumeration enums=list.elements();
while(enums.hasMoreElements()){
String goods=(String) enums.nextElement();
byte b[]=goods.getBytes("ISO-8859-1");
goods=new String(b);
out.println("br"+goods);
}
%
/font/font
%String strl=response.encodeRedirectURL("car.jsp"); %
form action="%=strl %" method="post" neme="form"
input type="submit" value="继续购物"
/form
%@include file="tail.jsp" %
/body
/html
6.removeWork.jsp删除页面:
%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%
%@ page import="java.util.*" %
%@ page import="web.Car" %
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
base href="%=basePath%"
title购物车/title
meta http-equiv="pragma" content="no-cache"
meta http-equiv="cache-control" content="no-cache"
meta http-equiv="expires" content="0"
meta http-equiv="keywords" content="keyword1,keyword2,keyword3"
meta http-equiv="description" content="This is my page"
!--
link rel="stylesheet" type="text/css" href="styles.css"
--
/head
body
%@include file="header.jsp" %
hr
font size="2"
jsp:useBean id="Car" class="web.Car" scope="session"
/jsp:useBeanbr
%String str=response.encodeRedirectURL("removeWork.jsp"); %
%String name=request.getParameter("deleteitem");
if(name==null)
name="";
byte c[]=name.getBytes("ISO-8859-1");
name=new String(c);
Car.dele_h(name);
out.println("您删除了货物"+name);%
/font
font face="楷体_GB2312"
font color="#FF8040" size="2"
p您的购物车有如下商品:
%
Hashtable list=Car.list_h();
Enumeration enums=list.elements();
while(enums.hasMoreElements()){
String goods=(String) enums.nextElement();
byte b[]=goods.getBytes("ISO-8859-1");
goods=new String(b);
out.println("br"+goods);
}
%
/font/font
%String strp=response.encodeRedirectURL("car.jsp"); %
form action="%=strp %" method="post" neme="form"
input type="submit" value="继续购物"
/form
%String strl=response.encodeRedirectURL("selectRemoveGoods.jsp"); %
form action="%=strl %" method="post" neme="form"
input type="submit" value="修改购物车中的物品"
/form
/body
/html
7.header.jsp页面头部:
%@ page language="java" import="java.util.*" pageEncoding="GB2312"%
center
========================================================================br
购物车系统br
=======================================================================br
???????????
??????WELCOME!
jsp:getProperty name="Car" property="userID"/
当前时间是:
%=new java.util.Date().toLocaleString() %
br
/center
8.tail页面尾部
%@ page language="java" import="java.util.*" pageEncoding="GB2312"%
center
hr
JSP+TOMCAT购物系统
/center
9.Car.java类
package web;
import java.util.*;
import java.io.*;
public class Car implements Serializable{
Hashtable list=new Hashtable(); //散列表,商品列表
String item="Welcome";
int mount=0; //商品数量
String unit=null; //商品单位
String userID; //用户
public void Car(){
}
public void setItem(String item) {
this.item = item;
}
public void setMount(int mount) {
this.mount = mount;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
public Hashtable list_h() {
return list;
}
public void dele_h(String s) {
list.remove(s);
}
public void add_h(){
String str="Name:"+item+"Mount:"+mount+"Unit:"+unit;
list.put(item, str);
}
}