2021/4/20数据库课内作业实验

在这里插入图片描述

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <script>
            function order() {
                var name = document.getElementById("xm").value;
                if (name == "") {
                    alert("请输入姓名");
                    return;
                }

                var sex = document.getElementsByName("xb");
                var sexValue = "";
                for (let i = 0; i < sex.length; i++) {
                    if (sex[i].checked == true) {
                        sexValue = sex[i].value;
                    }
                }

                var fruits = document.getElementsByName("fruit");
                var orders = ""
                for (let i = 0; i < fruits.length; ++i) {
                    if (fruits[i].checked == true) {
                        if(orders != "") {
                            orders += ", ";
                        }
                        orders += fruits[i].value;
                    }
                }

                var info = document.getElementById("info");
                if (orders == "") {
                    info.innerHTML="你没有订购任何水果。";
                } else {
                    info.innerHTML="姓名:" + name + "<br>性别:" + sexValue + "<br>你订购了:"
                        + orders;
                } 
            }
        </script>
    </head>
    <body>
        <h1>实验一:Javascript与html基础</h1>
        <h2>订购水果</h2>
        <form action="" method="POST" name="theForm">
            姓名:
            <input id="xm" type="text" size="20" maxlength="10">
            性别:
            <input name="xb" type="radio" value="男" checked><input name="xb" type="radio" value="女"><br>
            选择需要的水果
            <hr>
            <input name="fruit" type="checkbox" value="苹果">苹果<br>
            <input name="fruit" type="checkbox" value="香蕉">香蕉<br>
            <input name="fruit" type="checkbox" value="菠萝">菠萝<br>
            <input name="fruit" type="checkbox" value="橘子">橘子<br>
            <input name="fruit" type="checkbox" value="樱桃">樱桃
            <hr>
            <button type="button" value="订购" onclick="order()">订购</button>
        </form>
        <hr>
        <div id="info"></div>
    </body>
</html>





在这里插入图片描述

在这里插入图片描述

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<form action="" method="post" name="form333">
input n:<input name="n" type="text"  id="n" maxlength="5"><p>
<input name="button" type="button" value="计算" onClick="cal();">

result :
<input name="result" type="text" readonly="true" id="result
">
</form>
<hr color="#3333CC">
<script language="javascript" type="text/javascript">
function cal()
{
	x=document.form333.n.value;
	if(!isNaN(x) && x>=1)
	{
		var i,y=0;
		for(i=1;i<x;i++){y=y+i;}
		document.form333.result.value =y;
	}
	else
	{ document.form333.result.value = "输入的n 不合法";
	}
	
}
</script>


</body>
</html>

在这里插入图片描述

在这里插入图片描述

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<img src="../php/sy2-1.jpg" width="810" height="468" />
<hr />


<?php
	$x=$_GET["x"];
	if($x>10){
	$y =$x*$x +0.5;
	}else if($x<=10){
	$y =$x*$x +0.5;
	
	}else{
		$y =$x*$x +0.5;
	
	}
	echo "x = $x, y = $y";
?>

</body>
</html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<img src="../php/sy2-1.jpg" width="810" height="468" />
<hr />

<form action="sy 2-1 demo1.php" method="get">
input :<input name="x" type="text"/>
<input  type="submit" value="提交" />
</form>
</body>
</html>

在这里插入图片描述

在这里插入图片描述

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<table width="700" border="1" cellspacing="2" cellpadding="0">

<?php
	for($r=1;$r<=8;$r++){
		if($r%2==0){
		$ys = "#FFFFFF";
		}else{
		$ys = "#00FF66";}
	?>
	<tr bgcolor=<?php echo $ys; ?>>
	
	<?php for($c=1;$c<=5;$c++){ ?>
<td align="center">江龙杰大帅哥</td>
	<?php }?>
	   
	</tr>
	<?php } ?>
</table>

</body>
</html>

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>

<?php
	$c1=1;$y=2017; $n=0;
	while($c1 <2)
	{
	$c1 =$c1 *1.2;
	$y++;
	$n++;
		echo "$n  -----{$y}年,
		产量:$c1<br>";
	}
?>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值