大一html网页制作期末源代码(大一网页制作期末题)

http://www.itjxue.com  2023-02-14 20:57  来源:未知  点击次数: 

html期末大作业源代码参考!!!

亲,我自己写的个人主页,很符合你I的需求,希望能够帮助到你。

大一网页设计期末作业 求一个代码 静态的都行 谢谢

代码可复制:

import java.util.ArrayList;

import java.util.Random;

import java.util.Scanner;

/**

* 21点游戏。

* 1、洗牌

* 2、发牌

* 3、计算点数

* 4、 是否要牌

* 5、计算机发牌

* 6、计算结果

*/

public class TPoint{

private int[] pai = new int[52];?//52张牌

private String[] huase= {"黑","红","梅","方"};

private String[] paiM = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"};//牌面显示

private ArrayListInteger al = new ArrayListInteger();?//存储玩家手中的牌

private int currentPoint;

private int computerPoint = 0;

private int currentPage=0;

public TPoint() {

super();

xipai();//?洗牌

fapai();//发牌

needPai();//是否要牌

computerPai();//电脑发牌

result();?//计算结果

}

private void xipai() {

for(int i = 0; i 52 ;i++ ){

pai[i]=i;?//52张牌赋值

}

for(int j = 0;j26;j++){?//打乱26次

Random r = new Random();

int i1 = Math.abs(r.nextInt()%52);?//在52张中牌中找到第一张

int i2 =Math.abs(r.nextInt()%52);//在52张中牌中找到第二张

int temp = pai[i2];

pai[i2] = pai[i1];

pai[i1] = temp;

}

}

private void fapai() {

/*?for(int i = 0;i52;i++){

System.out.print(pai[i]+"\t");

}*/

//先发两张给玩家

al.add(pai[0]);

al.add(pai[1]);

currentPoint += calPoint(pai[0]);

currentPoint+= calPoint(pai[1]);

currentPage= 2;

}

private int calPoint(int i) {//计算牌的点数

int temp = 0;

if(i%13+110){?//JQK都是10

temp = 10;

}

else{

temp = (i+1)%13;

}

return temp;

}

private void needPai() {

while(true){

xianshi();?//显示牌面

if(currentPoint=21){?//玩家点数大于21则不能再要牌

break;

}

System.out.println("是否还要牌,输入N不要!");

Scanner sc = new Scanner(System.in);

if(sc.next().equalsIgnoreCase("N")){

break;?//输入N则结束

}else {

al.add(pai[currentPage]);?//继续添加牌

currentPoint+=calPoint(pai[currentPage]);?//牌点数+

currentPage++;

}

}

}

private void xianshi() {

for(Integer in:al){?//显示玩家手中的牌

System.out.print(huase[in/13]+" "+paiM[in%13]+"\t");?//显示花色 和牌面

System.out.println("当前总分:"+currentPoint);

}

private void computerPai() {

Random r = new Random();

computerPoint = Math.abs(r.nextInt())%10+16;?//电脑的点数在16点到26点

System.out.println("\n电脑 的牌面:"+computerPoint);

}

private void result() {

if(currentPoint21){?//玩家点数大于21则不能再要牌

System.out.println("you lost!");

}else if(currentPoint==computerPoint){

System.out.println("you lost!");

}else if(computerPoint21){

System.out.println("you Win!");

}else if(currentPointcomputerPoint){

System.out.println("you Win!");

}else{

System.out.println("you Lost!");

}

}

public static void main(String[] args){

new TPoint();

}

}

扩展资料:

对于计算机而言,并不存在真正意义上的“好”的源代码;然而作为一个人,书写习惯的好坏将决定源代码的好坏。源代码是否具有可读性,是判断其好坏的重要标准。软件文档则是表明可读性的关键。

代码作为程序员用开发工具所支持的语言写出来的源文件,设计的原则包括唯一确定性、标准化和通用性、可扩充性与稳定性、便于识别与记忆、力求短小与格式统一以及容易修改等。

源代码是代码的分支,某种意义上来说,源代码相当于代码。现代程序语言中,源代码可以书籍或磁带形式出现,但最为常用格式是文本文件,这种典型格式的目的是为了编译出计算机程序。计算机源代码最终目的是将人类可读文本翻译成为计算机可执行的二进制指令,这种过程叫编译,它由通过编译器完成。

如何用html编写一个简单的网页

简单的html网页可以直接利用文本编写的,无需下载特定编辑器。

1、在我们的windows操作系统中,桌面上鼠标右键新建一个txt文本,并命名为"最简单网页",只是便于标识,实际上并不影响我们的操作。注意我们需要提前在文件属性中把扩展名显示出来。

2、我们打开文件夹属性设置,将文件扩展名显示出来,后面我们需要对文件扩展名进行操作,不同操作系统的设置位置不太一样,我们可以直接搜索"文件夹属性"来进行查找修改。

3、然后输入最简单的HTML文本语言。

代码如下:

html

body

最简单的网页

/body

/html

4、保存并关闭txt文本,然后修改我们txt文本的扩展名为html,此时会弹出警告框,提示我们修改后可能会导致文件不能使用,这是操作系统的一个处理逻辑,为了防止无意或恶意的损坏文件的行为。

5、无需担心,因为这在我们自己的掌控之下,确认警告,点击"是",然后双击打开我们自己的第一个html网页,就可以看到一个最简单的html网页了。

用html如何制作一个简单的网页代码?

1、首先,在计算机桌面上创建一个新文件夹,然后在该文件夹中创建一个新的文本文档。

2、然后双击打开带有记事本的文本文档,如下图所示,我们编写一个简单的html代码。

3、单击“另存为”的功能选项,显示默认保存为编码为ANSI。

4、我们将更改编码和文件名,将其更改为如图所示的图像并保存。

5、然后返回到新创建的文件夹,发现有一个额外的html文件。

6、最后,使用浏览器打开html文件,效果如图所示,简单的网页被成功编写。

网页设计常用HTML代码

网页设计常用HTML代码大全

HTML是用来描述网页的一种语言。下面我为大家分享HTML代码,希望对大家学习html代码有帮助!

忽视右键

body oncontextmenu="return false"

body style="overflow-y:hidden"

1.如何几秒后转到别的页面?

META HTTP-EQUIV="Refresh" CONTENT="时间;URL=地址"

2.点击关闭窗口

a href="javascript:top.window.close();"点击关闭窗口/a!

3.请问如何去掉主页右面的滚动条?

body scroll="no"

body style="overflow-y:hidden"

4.请问如何做到让一个网页自动关闭.

html

head

OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"

param name="Command" value="Close"

/object

/head

body onload="window.setTimeout(‘‘‘‘closes.Click()‘‘‘‘,10000)"

这个窗口会在10秒过后自动关闭,而且不会出现提示. /body

如何在不刷新页面的情况下刷新css?

style

button{ color:#000000;}

/style

button onclick=document.styleSheets[0].rules[0].style.color=‘‘‘‘red‘‘‘‘点击按钮直接修改style标签里button选择符使按钮改为红色/button

请问如何让网页自动刷新?

在head部记入META HTTP-EQUIV="Refresh" content="20"其中20为20秒后自动刷新,你可以更改为任意值。

5.如何让页面自动刷新?

方法一,用refresh

HTML 代码片段如下:

head

meta http-equiv="refresh" content="5"

/head

5表示刷新时间

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

方法二,使用setTimeout控制

img src=/logo.gif

script

function rl(){

document.location.reload()

}

setTimeout(rl,2000)

/script

6.如何让超链接没有下划线

在源代码中的HEAD…/HEAD之间输入如下代码:

style type="text/css" !--

a { text-decoration: none}

-- /style

7.请问如何去掉IE的上下滚动条?

body style=‘‘‘‘overflow:scroll;overflow-y:hidden‘‘‘‘

/body

8.怎样才能把RealPlayer文件在网页做一个试听连接?

embed height=25 src=51js.rm type=audio/x-pn-realaudio-plugin width=50 autostart="false" controls="PlayButton"

9.如何用html实现浏览器上后退按钮的功能?

a href="java script:history.go(-1)"点击后退/a

或者

script history.back() /script

10.请问怎么在网页中改变鼠标的箭头形状?

HTML 代码片段如下:

body

a href="#" style="cursor: auto;"auto/abr

a href="#" style="cursor: crosshair "crosshair /abr

a href="#" style="cursor: default "default /abr

a href="#" style="cursor: hand "hand /abr

a href="#" style="cursor: move "move /abr

a href="#" style="cursor: e-resize "e-resize /abr

a href="#" style="cursor: ne-resize "ne-resize /abr

a href="#" style="cursor: nw-resize"nw-resize/abr

a href="#" style="cursor: n-resize"n-resize/abr

a href="#" style="cursor: se-resize"se-resize/abr

a href="#" style="cursor: sw-resize"sw-resize/abr

a href="#" style="cursor: s-resize"s-resize/abr

a href="#" style="cursor: w-resize"w-resize/abr

a href="#" style="cursor: text"text/abr

a href="#" style="cursor: wait"wait/abr

a href="#" style="cursor: help"help/abr

/body

11.怎样不使用页面的缓存?即每一次打开页面时不是调用缓存中的东西

META HTTP-EQUIV="Pragma" CONTENT="no-cache"

12.页面打开时自动弹出一个窗口的代码怎么写?

HTML 代码片段如下:

html

head

titleUntitled Document/title

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

script language="B style="color:black;background-color:#A0FFFF"javascript/B"

!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

window.open(theURL,winName,features);

}

//--

/script

/head

body bgcolor="#FFFFFF" text="#000000" onLoad="MM_openBrWindow(‘‘‘‘‘‘‘‘,‘‘‘‘,‘‘‘‘width=400,height=400‘‘‘‘)"

/body

/html

13.如何让我的页面出现一个会讲话的小人?Merlin

HTML 代码片段如下:

HTML

HEAD

TITLE默林/TITLE

META http-equiv=Content-Type content="text/html; charset=gb2312"

/HEAD

BODY

pOBJECT id=sims classid=CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F

/OBJECT

SCRIPT

var MerlinID;

var MerlinACS;

sims.Connected = true;

MerlinLoaded = LoadLocalAgent(MerlinID, MerlinACS);

Merlin = sims.Characters.Character(MerlinID);

Merlin.Show();

Merlin.Play("Surprised");

Merlin.Speak("大家好");

Merlin.Play("GestureLeft");

Merlin.Think("我是默林!");

Merlin.Play("Pleased");

Merlin.Think("可爱吗?");

Merlin.Play("GestureDown");

Merlin.Speak("哈哈!");

Merlin.Hide();

function LoadLocalAgent(CharID, CharACS){

LoadReq = sims.Characters.Load(CharID, CharACS);

return(true);

}

/SCRIPT

/p

p /p

p看此效果必须装有office2000!!!/p

/BODY

/HTML

14.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动

HTML 代码片段如下:

htmlhead

STYLE

body  {background-image:url(logo.gif);

background-repeat:no-repeat; background-position:center }

/STYLE

/head

body bgproperties="fixed"

/body

/html

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

background-repeat:no-repeat; 是让背景图不占满整个页面

body bgproperties="fixed" 是拉动scroll时背景图不动

15.文本输入框什么属性能实现不可输入?

HTML 代码片段如下:

input type="text" name="textfield" disabled

或者

input type="text" name="textfield" readonly

16.如何禁止自己的页面在别人的框架里打开?

把以下代码加至你的head区

script

if (window.top!=self){

window.top.location=self.location

}

/script

17.如何实现首页全屏幕显示?

HTML 代码片段如下:

html

bodyscript language="B style="color:black;background-color:#A0FFFF"javascript/B"

var coolw=642

var coolh=400

var coolhuang=window.open("","coolhuang","width="+coolw+",height="+coolh+",

fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0")

window.close()

/script/body/html

18.如何监听一个窗口被关闭了?

HTML 代码片段如下:

body onunload="alert(‘‘‘‘你关闭了这个窗口‘‘‘‘)"

19.如何禁止Ctrl+N?

HTML 代码片段如下:

body onkeydown=return(!(event.keyCode==78event.ctrlKey))

如何把页面加入用户的收藏夹?

HTML 代码片段如下:

a href="B style="color:black;background-color:#A0FFFF"javascript/B:window.external.AddFavorite(‘‘‘‘‘‘‘‘,‘‘‘‘无忧脚本‘‘‘‘)"收藏无忧脚本/a

如何在我的'页面中加入背景音乐?

IE: bgsound src="*.mid" loop=infinite

NS:embed src="*.mid" autostart=true hidden=true loop=true

*.mid你的背景音乐的midi格式文件

关于页面转换效果

meta http-equiv="page-enter" content="revealTrans(Duration=4,Transition=23)"

meta http-equiv="page-exit" content="revealTrans(Duration=4,Transition=23)"

说明:Transition=23是随机效果,另可以选0-22任一数字固定某个效果

如何设定打开页面的大小

HTML 代码片段如下:

body onload="top.resizeTo(300,200);"!--(width,height)--

怎样双击滚屏,单击停止?

HTML 代码片段如下:

html

head

title新网页1/title

/head

body

script language"B style="color:black;background-color:#A0FFFF"javascript/B"

var currentpos,timer;

function initialize()

{

timer=setInterval("scrollwindow()",10);

}

function sc(){

clearInterval(timer);

}

function scrollwindow()

{

currentpos=document.body.scrollTop;

window.scroll(0,++currentpos);

if (currentpos != document.body.scrollTop)

sc();

}

document.onmousedown=sc

document.ondblclick=initialize

/script

pa/ppa/ppa/ppaa/ppaa/ppaa/p

paa/ppaa/ppaa/ppaa/ppaa/ppaa/p

paa/ppaa/ppaa/ppaa/ppaa/ppaa/p

paa/ppaa/ppaa/ppaa/ppa/p

/body

/html

如何让body中的文字不被选中?

HTML 代码片段如下:

body onselectstart="return false" aaa/body

如何让弹出的窗口不能关闭?

在新开的窗口中加入如下代码

body onunload=open(location.href)

/body

如何让浏览器在保存页面时保存失败?

HTML 代码片段如下:

NOSCRIPT

B style="color:black;background-color:#ffff66"IFRAME/B SRC="*.html"

/B style="color:black;background-color:#ffff66"IFRAME/B

/NOSCRIPT

表单中如何用图片按钮实现 reset?

html

head

script

function aaa(){

document.forms[0].reset()

}

/script

/head

body

form

textarea rows="2" name="S1" cols="20"/textarea

input type="submit" values="提交" name="B1"

image src="logo.gif" onclick=aaa()

/form

/body/html

进入网页时弹出的信息对话框

body onLoad="window.alert(‘‘‘‘欢迎光临本站‘‘‘‘)"

关闭窗口后弹出对话框

body onUnload="window.alert(‘‘‘‘谢谢你的光临!欢迎下次再来!‘‘‘‘)"

告别提示

body onUnload= alert("再见,感谢你的访问!")

右键菜单的制作

OBJECT id=menu type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"

PARAM name="Command" value="Related Topics,menu"

PARAM name="Item1" value="动易;"

PARAM name="Item2" value="搜狐;"

PARAM name="Item3" value="新浪;"

PARAM name="Item4" value="网易;"

PARAM name="Item5" value="互动学院;"

/OBJECT script if (document.all) document.body.onmousedown=new Function("if (event.button==2) menu.Click();") /script

下拉菜单

object id=HHCtrl type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" PARAM name="Command" value="Related Topics,Menu" PARAM name="Item1" value="aspease;" PARAM name="Item2" value="byhu;" PARAM name="Item3" value="lzz;" /object a href=javascript:HHCtrl.Click() title="下拉菜单"下拉菜单/a

;

html网页制作、跪求源代码

效果图,图片自己换,

html代码:

!DOCTYPE html

html

head

meta charset="utf-8"/

title泰国/title

link rel="stylesheet" type="text/css" href="css/index.css"/

script type="text/javascript" src="js/index.js"/script

/head

body

div class="box"

? div class="titles"泰国/div

? div class="img-box"

? ? img class="auto-img" src="images/a001.jpg"/

? /div

? div class="text-box"

? ? div class="text-box-a"

? ? ? a href="#"曼谷、芭提雅(珊瑚岛、金沙岛)5晚7天/a

? ? /div

? ? div class="text-box-a"

? ? ? 东航直飞曼谷客机,入住1晚曼谷国际5星+4晚泰式5星酒店,芭提雅双岛(珊瑚岛+金沙岛)清...

? ? /div

? ? div class="text-box-a"

? ? ? 出发日期:星期一,星期二,星期三,星期四,星期五

? ? /div

? /div

? div class="bottom ovf"

? ? div class="fl text-a1"

? ? ? 班期:每周发团

? ? /div

? ? div class="fr"

? ? ? div class="price"¥nbsp;4549/div

? ? ? div class="rush-to-buy"立即抢购/div

? ? /div

? /div

/div

/body

/html

css样式:

html,body{

padding:0;

margin:20px 0 0;

}

a{

text-decoration:none;

}

.fl{

float:left;

}

.fr{

float:right;

}

.ovf{

overflow: hidden;

}

.box{

width:50%;

margin:0 auto;

border:1px dashed #000000;

padding:4px;

}

.titles{

width:100%;

text-align: center;

color:#ffffff;

background-color: #ff0000;

}

.img-box{

width:100%;

margin-top: 4px;

}

.auto-img{

display: block;

width:100%;

}

.text-box{

width:100%;

}

.text-box-a{

width:100%;

font-size: 14px;

line-height: 20px;

letter-spacing: 1px;

}

.text-box-aa{

color:#0089ff;

}

.bottom{

margin-top: 30px;

}

.text-a1{

font-size: 18px;

font-style: italic;

font-style:oblique;/*为保证斜体效果加一个*/

}

.price{

font-size: 16px;

color:#8B3E2F;

}

.rush-to-buy{

width:80px;

text-align: center;

background-color: #ff0000;

font-size: 16px;

}

(责任编辑:IT教学网)

更多

推荐java认证文章