web技术编程练习题目
更新时间:2023-12-10 01:56:01 阅读量: 教育文库 文档下载
作业1:
1.Create, test, and validate an XHTML document that describes an ordered list of your five favorite movies.
=
″
http://www.w3.org/1999/xhtml″>
My Favorite Movies
十二生肖
哈利波特与死亡圣器 盗梦空间 阿甘正传 阿凡达
2.Create, test, and validate an XHTML document that describes a table with the following contents: The columns of the table must have the headings “Pine”, “Maple”, “Oak”, and “Fir”. The rows must have the labels “Average Height”, “Average Width”, “Typical Life Span”, and “Leaf Type”. You can make up the data cell values.
=
″
http://www.w3.org/1999/xhtml″>
40m 25m
3.Create, test, and validate an XHTML document that has a form with the following controls:?
a. A text box to collect the user’s name b. Four checkboxes, one each for the following items:
i. Four 100-watt light bulbs for $2.39 ii. Eight 100-watt light bulbs for $4.29
iii. Four 100-watt, long-life light bulbs for $3.95
iv. Eight 100-watt, long-life light bulbs for $7.49
c. A collection of three radio buttons that are labeled as follows: i. Visa ii. Master Card
iii. Discover
xmlns
=
″
http://www.w3.org/1999/xhtml″>
2.Create an XML document with at least
2 speed automatic
radio
=
air_conditioning = \ power_windows = \ power_steering = \ \
作业2:
1.Create a DTD for a catalog of cars, where each car has the child elements make,
model, year, color, engine,
number_of_doors,
transmission_type,
and accessories. The engine element has the child elements number_of_cylinders and fuel_system (carbureted or fuel injected). The accessories element has the attributes
radio,
air_conditioning,
power_windows, power_steering, and power_brakes, each of which is required and has the possible values yes and no. Entities must be declared for the names of popular car models.
(#PCDATA)>
accessories
power_brakes three instances of the car element defined in the DTD of Exercise 1. Process this document by using the DTD of Exercise 1, and produce a display of the raw XML document.
SYSTEM
“./cars.dtd\
8
cylinder
4
door
4 speed automatic
8
cylinder
power_brakes = \
8
cylinder
4
door
4 speed automatic
3.Create an XML schema for the XML document described in Exercises 1 and 2. xmlns:xsd=\ Schema\ xmlns=\rSchema\ targetNamespace=http://www.njupt.edu.cn/se/carSchema elementFormDefault=\ mal\ 作业3: 9.10 Write the XHTML code to create a form with the following capabilities: a. A text widget to collect the user’s name b. Four checkboxes, one each for the following items: i. Four 100-watt light bulbs for $2.39 ii. Eight 100-watt light bulbs for $4.29 iii. Four 100-watt long-life light bulbs for $3.95 iv. Eight 100-watt long-life light bulbs for $7.49 c. A collection of three radio buttons that are labeled as follows: i. Visa ii. MasterCard iii. Discover html PUBLIC ″ -//W3C//DTD XHTML 1.0 Strict//EN″ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> xmlns = ″ http://www.w3.org/1999/xhtml″> 9.11 Write a PHP script that computes the total cost of the ordered light bulbs from Exercise 9.10 after adding 6.2 percent sales tax. The program must inform the buyer of exactly what was ordered, in a table. xmlns = \ if( empty($_POST[\ $bulbs1=0; else $bulbs1=$_POST[\if( empty($_POST[\ $bulbs2=0; else $bulbs2 = $_POST[\ if( empty($_POST[\ $bulbs3=0; else $bulbs3 = $_POST[\if( empty($_POST[\ $bulbs4=0; else $bulbs4 = $_POST[\$payment=$_POST[\ $cost=$bulbs1+$bulbs2+$bulbs3+$bulbs4; printf(\cost is $ %4.2f Four 100-watt light bulbs for $2.39 print(\100-watt light bulbs for $4.29 print(\100-watt, long-life light bulbs for $3.95 print(\100-watt, long-life light bulbs for $7.49 is $payment 1、个人主页代码: width=800 height=550 background=\ padding-bottom=0px padding-left=0px padding-right=0px background=\ color=#FF0 padding-top=0px align=\ width=200 height=150 src=\姚雪宁的照片\ 个人经历 1993年,出生于?? 2000年,进入小学 2005年, 2008年,考入当地最好的高中,太谷第一中学 2011年,以优异的成绩考入南京邮电大学
个人简介
个人经历简介:
最喜欢的四本书
达芬奇密码 哈利波特与混血王子 红岩
福尔摩斯探案全集
个人兴趣简介
个人兴趣
友情链接
主
干
课
成
绩
高等数学 2012秋季 张三 90
高等数学 2012秋季 张三 90
高等数学 2012秋季 张三 90
数据结构 2014秋季 张三
90
大学物理 2012春季 李四 90
离散数学 2013秋季 王五 90
javascript脚本嵌入代码:
实验二:
1.图书售卖界面代码:
xmlns
=
\
服务器端代码:
// Get form data values
if(empty($_POST[\else
$web = $_POST[\if(empty($_POST[\else
$math = $_POST[\if(empty($_POST[\else
$os = $_POST[\
if(empty($_POST[\else
$matrix = $_POST[\ $name = $_POST[\ $address = $_POST[\ $zip = $_POST[\
$payment = $_POST[\// Compute the item costs and total cost $web_cost = 5.0 * $web; $math_cost = 6.2 * $math; $os_cost = 10 * $os; $matrix_cost = 7.8 * $matrix; $total_price =
$web_cost
+ $math_cost +
$os_cost
+
$matrix_cost;
$total_items = $web + $math + $os + $matrix;
// Return the results to the browser in a table ?>
Customer:
$name
address: $address
zip: $zip
\ ?>Order
Information
=
%quot
center %quot>
Web technology Springer press $5.0 $web_cost \ ?>
if($math) print(\align
=
%quot
center %quot>
mathematics ACM press $6.2 $math_cost \
=
%quot
center %quot> principle of OS Science press $10
$os_cost \
if($matrix) print(\align
=
%quot
center %quot >
Theory of matrix High education press $7.8 $matrix_cost \
(\
has
bought
$total_items books
\
printf (\$total_price);
print (\ ?>
$fo=fopen(\
fwrite($fo,\has bought $total_items books,$name paid $total_price dollars,paid by $payment.\\r\\n\fclose($fo); ?> 实验三: Main.php代码:
mysql_connect(\
if(!$conn) { die('Could
not connect:' . mysql_error());
}
?>
--------Create
database-------- */
$DB = \数据库名为Book_Seller
//判断数据库是否存在,
访问系统数据库information_schema
mysql_select_db(\a\or die(\选择失败!\//访问系统数据库 $sql =
\
schema_name from schemata limit 0,30\ $result_db
=
mysql_query($sql,$conn);
$bo = false;//创建bool型变量,用以判断
while($result
=
mysql_fetch_array($result_db,MYSQL_BO
TH)) {
//echo
$result[\
if($result[\== $DB)//数据库已存在,跳过就好啦~
{ $bo = true; break;
}
}
//开始判断
if(!$bo)//$bo=false,即该
数据库不存在,需要创建;存在的话就不管了
{
if(mysql_query(\database
Book_Seller\创建成功
{ //echo
\ } else { echo \
creating datablse: \ exit;
}
}
/* --------Create table in
Book_Seller database-------- */ //Use database $er =
mysql_select_db(\ if(!$er) { echo \_ Could not select the database\
exit;
}
//判断表是否存在,有三
个表,User,Book,Order_form,建个数组用循环语句实现 $tables = array(\\
$sqls = array(//User表语句
\table User(name varchar(20)
primary key not null, address varchar(100) not null, zip varchar(10) )\表语句
\
book varchar(20) primary key not null, publisher varchar(50) not null,
price double)\表语句 \
id int not null auto_increment primary key, name varchar(20) not null, book varchar(20) not null, quantity int not null,
foreign key (name) references User(name), foreign key (book) references Book(book))\); for($i=0; $i<3; $i++)//遍历数组
{
//判断表是否存在
if(mysql_num_rows(mysql_query(\ow tables like '\不存在,建表 {
$sql
=
$sqls[$i];
if(mysql_query($sql, $conn)) { //echo
$tables[$i] . \创建成功\
}
else { echo $tables[$i] . \创建失败\
exit;
}
}
}
?>
//查询用户是否存在
$result
=
mysql_query(\count(*) as num from User where name='\. $_POST['name'] . \ $r
=
mysql_fetch_array($result);
if($r[\< 1)//该用户不存在,添加
{
$sql = \into
User values('\$_POST['name'] .\$_POST['address'] .\ if(!mysql_query($sql, $conn))
{ die('ERROR: ' .
mysql_error());
}
}
else //用户存在,修改信
息 {
$sql = %user set address='\$_POST['zip'] .\
where
name='\
$_POST['name'] .\
if(!mysql_query($sql, $conn))
{ die('ERROR: ' .
mysql_error());
} }
/* ----------插入数据,第
二张表 Book------------ */ //为书名建数组
$books
=
array(\
technology\of
OS\
//查询书籍是否存在,4本书 //Web technology
$result
=
mysql_query(\count(*) as num from Book where book='\ $r
=
mysql_fetch_array($result);
if($r[\< 1)//书籍不
存在,添加
{
$sql = \into
Book values('\$books[0] .\press','5.0')\ if(!mysql_query($sql, $conn))
{ die('ERROR: ' .
mysql_error());
}
}
//mathematics
$result
=
mysql_query(\count(*) as num from Book where book='\ $r
=
mysql_fetch_array($result);
if($r[\< 1)//书籍不存在,添加
{
$sql = \into Book values('\$books[1]
.\
press','6.2')\
if(!mysql_query($sql, $conn))
{ die('ERROR: ' .
mysql_error());
}
}
//principle of OS
$result
=
mysql_query(\count(*) as num from Book where book='\
$r = mysql_fetch_array($result);
if($r[\< 1)//书籍不存在,添加
{
$sql = \into Book values('\$books[2] .\press','10')\ if(!mysql_query($sql, $conn))
{ die('ERROR: ' .
mysql_error());
}
}
//Theory of matrix
$result
=
mysql_query(\count(*) as num from Book where book='\ $r
=
mysql_fetch_array($result);
if($r[\< 1)//书籍不存在,添加 {
$sql = \into Book values('\$books[3]
.\
education press','7.8')\
if(!mysql_query($sql, $conn))
{ die('ERROR: ' .
mysql_error());
}
}
/* ----------插入数据,第三张表 Order_form------------ */ //建数量数组
$quantities
=
array($_POST['web'],$_POST['math'],$_POST['os'],$_POST['matrix']); //检查数量项是否为空。不为空则添加进表,为空则不管
for($i=0; $i<4; $i++) {
if(!empty($quantities[$i]))
{ //判断数据库是否存在此条信息
$result
=
mysql_query(\count(*) as num from Order_form where name='\$_POST['name'] .\and book='\
$books[$i] .\
$r
=
mysql_fetch_array($result); if($r[\< 1)//书籍不存在,添加
{
$sql
=
\values('\$_POST['name'] .\
$books[$i] .\
if(!mysql_query($sql, $conn))
{
die('ERROR: ' . mysql_error());
} }
else //书籍存在,更改数量信息
{
$sql
=
\$quantities[$i] .\where name='\$_POST['name'] .\and
book='\
$books[$i] .\
if(!mysql_query($sql, $conn))
{
die('ERROR: ' . mysql_error());
} } }
}
?>
//关闭连接 mysql_close($conn); ?>
//select.php
if(isset($_POST['submit'])) { ?>
//建立连接 $conn =
mysql_connect(\ if(!$conn) { die('Could
not connect:' . mysql_error());
}
//Use database $er =
mysql_select_db(\
if(!$er) { die('ERROR:
'
. mysql_error()); }
?>
$sql = \o.name
name,o.book book,b.publisher
publisher,o.quantity quantity,b.price price from
book
b,order_form
o
where
b.book=o.book and o.name='\
$_POST['name'] .\
$result =
mysql_query($sql, $conn); if(!$result) {
die('ERROR: '
.
mysql_error());
}
//总金额存放处 $allcost = 0.0;
//显示结果
print \查询结果:\
$num
=
mysql_num_rows($result);
if($num < 1)//结果集为空 {
print \该用户没有
订单\
}else {
//开始画表格 print
\
border='1' cellspacing='0' cellpadding='0'>\
//第一行标题 print \
align='center'>\ print \ print \ print \ print \
print \ //查询内容 while($row = mysql_fetch_assoc($result))
{
print \align='center'>\
\
$row['name'] .\
print \$row['book'] .\ print \$row['publisher'] .\
\
$row['quantity'] .\ print \ $allcost +=
$row['quantity'] * $row['price'];
}
//显示总金额
print \align='right'>\
\colspan='4'>总金额: \
print \ print \
}
?>
?>
}
?>
正在阅读:
web技术编程练习题目12-10
小学英语元音音标教学教案07-24
部编版一年级语文上册复习教案05-19
标准施工合同05-25
2016-2017学年七年级(上)期末数学试卷(五四学制)(解析版)09-29
java实例应用05-07
各省军区独立师历史沿革04-25
1501期广州市专业技术人员诚信与职业道德建设(视频答案)11-27
我国重大工程事故案例11 - 图文01-27
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 题目
- 练习
- 编程
- 技术
- web
- 第一章 分析方法概论
- LID设施计算(资料整合)
- (高新二小参加雁塔区先进集体评选的材料)书香校园灵气氲、六艺课程翰墨香(定稿)
- 大学物理(上)期末复习题
- 南艺英语课文Unit 9(附课后全习题)附翻译 - 图文
- 江苏省滨海县第一初级中学七年级数学下册复习讲义07苏科版
- 团课教育材料―如何发挥学生团员的模范带头作用(精)
- 《计算机体系结构》期末复习题答案
- 在职研究生毕业生登记表自我鉴定
- DEP常用脚本集2013
- 生物统计学课程教学大纲
- 商业银行法 案例及答案
- M2c 与F2C
- 汽车理论1.3和2.7matlab编程答案
- 统计学答案1
- 红领巾小主人-活动方案
- 2018-2024年中国呼吸机行业市场现状分析研究报告(目录) - 图文
- 试析留守儿童的心理问题
- 首都医科大医学统计学复习题
- 论文结尾致谢