文档详情

html+css入门基础文档(二).doc

发布:2025-06-09约2.92千字共6页下载文档
文本预览下载声明

Iframe的使用

?有时我们需要,在一个含有body的页面嵌入另外一个页面,形成画中画的效果,怎么处理-iframe元素(浮动窗口)

入门案例

Iframe.html

html

body

h1hello,world/h1

ahref=target=iframe1连接到taobao/Abr/

ahref=kk.htmltarget=iframe1连接到kk.html/Abr/

iframename=iframe1src=width=500pxheight=400px/

iframesrc=width=400pxheight=400px/

/body

/html

表单元素

为什么需要?

看一个图:

客户端

客户端

服务器

formaction=urlmethod=*

...

...

inputtype=submitinputtype=reset

/form

星号*部分可以为GET,也可以是POST

从上图可以看出,我们需要把一些数据提交给服务器处理,比如注册用户,发帖…,这样就需要使用到表单元素(常见输入框、单选框、复选框、文本域、密码框、上传文件。。。)

基本结构

inputtype=”类型”name=”名字”/

一般说,表单元素通常是被form包含起来的

Abc:inputtype=”text”name=”hobby”/

inputtype=”radio”/

formaction=”??”method=”get”

U:inputtype=”text”name=”username”/

inputtype=”submit”value=”xx”/

/form

formaction=”??”method=”??”

/form

入门案例:

Login.html

html

head

title登录页面/title

/head

body

!--action的值应当是提交哪个页面(url)--

!--method方法指定提交数据的方式,常用的有两种get/post--

formaction=ok.htmlmethod=post

!--name的值可以任意,但是不要使用关键字--

用户名:inputtype=textname=username/br/

密码:inputtype=passwordname=password/br/

inputtype=submitvalue=登录系统/

inputtype=resetvalue=重新填写/

/form

/body

/html

Ok.html

Ok,登录成功

原理图:

请考虑:如果我们希望偷偷的提交数据,不要影响节目效果,可以考虑使用隐藏域

案例代码:

html

headtitle表单元素/title/head

body

formaction=ok.htmlmethod=get

您最喜欢哪些城市:

inputtype=checkboxname=citiesvalue=beijing北京

inputtype=checkboxname=citiesvalue=shanghai上海

inputtype=checkboxname=citiesvalue=伦敦伦敦

br/

您的性别是:

inputtype=radioname=sexvalue=man男

inputtype=radioname=sexvalue=woman女br/

隐藏域的使用

inputtype=hiddenname=datavalue=ok/br/

下拉列表br/

请选择您的出生地:

selectname=addresssize=3multiple

optionvalue=sichuan四川/option

optionvalue=beijing北京/option

optionvalue=xizang西藏/option

/selectbr/

!--文本域,--

textareaname=mytextareacols=40rows=10

/textareabr/

!--文件上传的控件--

inputtype=filename=myfile上传文件br/

inputtype=submitvalue=测试/

!--这是一个图片按钮--

inputtype=imagesrc=image1.png/

/form

/body

/html

课堂练习:

多媒体

html

head

title我的电影网站/title

/head

body

!--

embedsrc=一起走到.MPG/--

imgsrc=F.GIFdynsrc=clock.aviloop=2star

显示全部
相似文档