当前位置:首页 > 代码 > 正文

html闪电代码(闪电风暴代码)

admin 发布:2022-12-19 22:38 147


本篇文章给大家谈谈html闪电代码,以及闪电风暴代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

html中文字闪烁效果代码是什么呢?

javasript 代码

div id="blink"闪烁的文字/div

script language="javascript"

function changeColor(){

var color="#f00|#0f0|#00f|#880|#808|#088|yellow|green|blue|gray";

color=color.split("|");

document.getElementById("blink").style.color=color[parseInt(Math.random() * color.length)];

}

setInterval("changeColor()",200);

/script

css代码就是文字闪烁text-decoration:blink;不过很可惜,IE、Chrome 或 Safari 不支持 "blink" 属性值,所以只有在 Firefox 和 Opera 下支持这 CSS 实现在闪动效果。加上js代码就可以了。

向HTML代码里加入流星飞逝的代码

第一步:把 body改为: body bgcolor=#000000" onLoad="snow()"

第二步:加入

script language="JavaScript"

!--

N = 40;

Y = new Array();

X = new Array();

S = new Array();

A = new Array();

B = new Array();

M = new Array();

V = (document.layers)?1:0;iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;

iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;

for (i=0; i N; i++){

Y[i]=Math.round(Math.random()*iH);

X[i]=Math.round(Math.random()*iW);

S[i]=Math.round(Math.random()*5+2);

A[i]=0;

B[i]=Math.random()*0.1+0.1;

M[i]=Math.round(Math.random()*1+1);

}

if (V){

for (i = 0; i N; i++)

{document.write("LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"'/LAYER")}

}

else{

document.write('div style="position:absolute;top:0px;left:0px"');

document.write('div style="position:relative"');

for (i = 0; i N; i++)

{document.write('div id="si" style="position:absolute;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#fffff0;font-size:'+M[i]+'"/div')}

document.write('/div/div');

}

function snow(){

var H=(document.layers)?window.innerHeight:window.document.body.clientHeight;

var W=(document.layers)?window.innerWidth:window.document.body.clientWidth;

var T=(document.layers)?window.pageYOffset:document.body.scrollTop;

var L=(document.layers)?window.pageXOffset:document.body.scrollLeft;

for (i=0; i N; i++){

sy=S[i]*Math.sin(90*Math.PI/180);

sx=S[i]*Math.cos(A[i]);

Y[i]+=sy;

X[i]+=sx;

if (Y[i] H){

Y[i]=-10;

X[i]=Math.round(Math.random()*W);

M[i]=Math.round(Math.random()*1+1);

S[i]=Math.round(Math.random()*5+2);

}

if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T}

else{si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T}

A[i]+=B[i];

}

setTimeout('snow()',10);

}

//--

/script

html中 文字闪烁效果代码详解

div id="blink"文字/div //●这一行是肉眼可见的div对象(★名字叫blink★),在浏览器中显示2个汉字

script language="javascript" //这一组script......./script是java程序,后台运行的

function changeColor()//这里{.......}花括号定义了一个名叫changeColor变色的函数

{

var color="yellow|green|blue|gray|pink"; //在内存变量color里定义5种颜色

color=color.split("|"); //定义数组5个元素分别放置5种颜色

//下面这一行是把名★叫blink的对象★的color属性随机改成5种颜色的一种

document.getElementById("blink").style.color=color[parseInt(Math.random() * color.length)];

}

setInterval("changeColor()",200); //●设置一个定时器,每200毫秒调用一次变色函数

/script

程序运行顺序是●●

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代码的内容远不止这些,想要在网页设计方面发展的朋友学好它是非常必要的。

网页设计常用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

;

Brackets编辑器怎样自动格式化HTML代码

 1

先打开Brackets编辑器,可以看到左边是目录,右边是代码区。

打开一个HTML文件,右上角有个闪电样子的图标就是实时预览功能,需要电脑中安装Chrome浏览器

2

其他的编辑器比如sublime之所以强大是因为有很多插件的支持,可以打造最适合自己的编辑器,那Brackets有没有插件呢?经过一番寻找终于找到:

点击文件--扩展管理器

可以看到里面有很多插件

3

而格式化代码是比较常用的功能,里面会不会有呢?先模糊搜索一下把,输入format关键字搜索,看见的第一个插件Beautify,名字听起来不错,再看下介绍:Format JavaScript, HTML, and CSS files,正和我们的需要,点击安装它把~

4

安装完成先别着急关掉扩展管理器,点击Beautify下面的更多信息,进入它在github的主页,往下看可以看到这样一行字:

Format HTML, CSS, and JavaScript files by Edit Beautify menu or Cmd-Alt-L(Mac) / Ctrl-Alt-L(Win) key.

也就是说从Edit-Beautify可以找到它,而且快捷键是Ctrl+Alt+L

5

因为是ubuntu系统,Ctrl+Alt+L默认是锁屏的快捷键,跟它有冲突,所以按下后直接就锁屏了,再看一下编辑中的选项,发现不但有个Beautify还有个Beautify On Save,也即保存后就自动格式化,把它勾上,然后弄乱自己的HTML代码试一下

html闪电代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于闪电风暴代码、html闪电代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/28073.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载