使用 《a》 标签的href 属性进行实现;
写法:《a href=http://haodro.com/archives/“url“》Link text《/a》;应用使用实例:《a href=http://haodro.com/archives/“希望链接到的网址“ target=“_blank“》爸爸妈妈!《/a》;
《a》 标签定义超链接,用于从一张页面链接到另一张页面。
《a》 元素最重要的属性是 href 属性,它指示链接的目标。
使用《a》标签可实现超链接,它在网页制作中可以说是无处不在,只要有链接的地方,就会有这个标签。
语法 :《a href=http://haodro.com/archives/“目标网址“ title=“鼠标滑过显示的文本“》链接显示的文本《/a》;
例如:《a这个属性在实际网页开发中作用很大,主要方便搜索引擎了解链接地址的内容(语义化更友好)
HTML超链接可以用a标签来设置。
1、新建html文档,在body标签中添加a标签,为a标签添加“href”属性:
2、设置“href”属性的属性值为“page.html”,这时点击a标签会跳转到“page.html”页面:
3、为a标签设置“target”属性,属性值为“_blank”,这样“page.html”会在新标签打开,设置为“_self”则会在自身页面打开:
01
使用代码软件,创建一个html结尾的文档。
02
把代码在《body》《/body》内,写入:《a href=http://haodro.com/archives/“url“》Link text《/a》,点击保存。
03
点击F12预览,或者直接在代码器中点击地球小图标,然后点击第一个预览,如下图所示内容。
04
超链接就创建成功了。
在一个《a》标签中加上一个《img》标签内容,即可让该《img》拥有一个超链接。然后可以在后面继续写文字,此文字就会显示成超链接,点击该文字即可进入超链接。下面实例:
《a href=http://haodro.com/archives/“www.baidu.com“》
《img border=“0“ src=http://haodro.com/archives/“/i/eg_buttonnext.gif“ /》《/a》
格式标志标签:
《p》《/p》 创建一个段落 (英文全称:Paragraphs)
《p align=““》 将段落按左、中、右对齐
《br/》定义新行
《blockquote》《/blockquote》 从两边缩进文本。
《dl》《/dl》 定义列表(英文全称:DefinitionList)。
《dt》 放在每个定义术语词前(定义术语、英文全称:DefinitionTerm)。
《dd》 放在每个定义之前(定义说明、英文全称:DefinitionDescription)。
《ol》《/ol》 创建一个标有序的列表,默认前面有数字,从数字“1”开始计数,依次叠加,也可以设置为字母或从任何自然数开始计数的列表项。
HTML-百度百科
给你四个演示文件:
文件top.htm内容如下:
《html》
《frameset cols=“40%,60%“》
《frame name=“left“ src=http://haodro.com/archives/“.left.htm“》
《frame name=“right“ src=http://haodro.com/archives/“.
ight.htm“》
《/framset》
《/html》
文件left.htm内容如下:
《body》
《a href=http://haodro.com/archives/1.htm target=_top》《font color=red》在父窗口显示《/font》《/a》
《a href=http://haodro.com/archives/1.htm》《font color=red》在左窗口显示《/font》《/a》
《a href=http://haodro.com/archives/1.htm target=right》《font color=red》在右窗口显示《/font》《/a》
《/body》
文件right.htm内容如下:
《body》
《a href=http://haodro.com/archives/1.htm target=_top》《font color=red》在父窗口显示《/font》《/a》
《a href=http://haodro.com/archives/1.htm target=left》《font color=red》在左窗口显示《/font》《/a》
《a href=http://haodro.com/archives/1.htm》《font color=red》在右窗口显示《/font》《/a》
《/body》
文件1.htm内容如下:
《html》
演示内容
《a href=http://haodro.com/archives/“javascript:history.back(1)“》返回上一页《/a》
《/html》
把这四个文件建立在同一个文件夹下,然后双击top.htm即可看到效果.
01
要给图片添加超链接也很简单,我们在html里先添加一个图片标签,img,
02
然后用超链接a标签将图片标签包围。
03
然后再为超链接标签添加href属性,指定链接的目标网址。
04
如上设置后,就可以了,在浏览器上打开,点击图片就会跳转到对应的网址的。
1、首先使用超链接,输入代码“a”。
2、接下来需要设置元素a,根据下图中的代码进行输入。
3、然后需要设置href值,也就是需要跳转的位置,根据下图中的代码进行输入自己想要的超链接。
4、然后这样就完成了。如图所示
5、然后设置后的效果图
6、然后点击文字就可以调到百度页面了,跳转网页图如下:
网页设计常用HTML代码大全
HTML是用来描述网页的一种语言。下面我为大家分享HTML代码,希望对大家学习html代码有帮助!
忽视右键
《body oncontextmenu=“return false“》
或
《body style=“overflow-y:hidden“》
1.如何几秒后转到别的页面?
《META HTTP-EQUIV=“Refresh“ CONTENT=“时间;URL=地址“》
2.点击关闭窗口
《a href=http://haodro.com/archives/“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.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表示刷新时间
方法二,使用setTimeout控制
《img src=http://haodro.com/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=http://haodro.com/archives/“java script:history.go(-1)“》点击后退《/a》
或者
《script》 history.back() 《/script》
10.请问怎么在网页中改变鼠标的箭头形状?
HTML 代码片段如下:
《body》
《a href=http://haodro.com/archives/“#“ style=“cursor: auto;“》auto《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: crosshair “》crosshair 《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: default “》default 《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: hand “》hand 《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: move “》move 《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: e-resize “》e-resize 《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: ne-resize “》ne-resize 《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: nw-resize“》nw-resize《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: n-resize“》n-resize《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: se-resize“》se-resize《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: sw-resize“》sw-resize《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: s-resize“》s-resize《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: w-resize“》w-resize《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: text“》text《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: wait“》wait《/a》《br》
《a href=http://haodro.com/archives/“#“ style=“cursor: help“》help《/a》《br》
《/body》
11.怎样不使用页面的缓存?即每一次打开页面时不是调用缓存中的东西
《META HTTP-EQUIV=“Pragma“ CONTENT=“no-cache“》
12.页面打开时自动弹出一个窗口的代码怎么写?
HTML 代码片段如下:
《html》
《head》
《title》Untitled 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(‘‘‘‘http://www.35ui.cn/‘‘‘‘,‘‘‘‘,‘‘‘‘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》
《p》《OBJECT 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 代码片段如下:
《html》《head》
《STYLE》
body {background-image:url(logo.gif);
background-repeat:no-repeat; background-position:center }
《/STYLE》
《/head》
《body bgproperties=“fixed“ 》
《/body》
《/html》
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》
《body》《script language=“《B style=“color:black;background-color:#A0FFFF“》javascript《/B》“》
var coolw=642
var coolh=400
var coolhuang=window.open(“http://www.35ui.cn“,“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==78&&event.ctrlKey))》
如何把页面加入用户的收藏夹?
HTML 代码片段如下:
《a href=http://haodro.com/archives/“《B style=“color:black;background-color:#A0FFFF“》javascript《/B》:window.external.AddFavorite(‘‘‘‘http://www.35ui.cn‘‘‘‘,‘‘‘‘无忧脚本‘‘‘‘)“》收藏无忧脚本《/a》
如何在我的’页面中加入背景音乐?
IE: 《bgsound src=http://haodro.com/archives/“*.mid“ loop=infinite》
NS:《embed src=http://haodro.com/archives/“*.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》
《p》a《/p》《p》a《/p》《p》a《/p》《p》aa《/p》《p》aa《/p》《p》aa《/p》
《p》aa《/p》《p》aa《/p》《p》aa《/p》《p》aa《/p》《p》aa《/p》《p》aa《/p》
《p》aa《/p》《p》aa《/p》《p》aa《/p》《p》aa《/p》《p》aa《/p》《p》aa《/p》
《p》aa《/p》《p》aa《/p》《p》aa《/p》《p》aa《/p》《p》a《/p》
《/body》
《/html》
如何让body中的文字不被选中?
HTML 代码片段如下:
《body onselectstart=“return false“ 》aaa《/body》
如何让弹出的窗口不能关闭?
在新开的窗口中加入如下代码
《body onunload=open(location.href)》
《/body》
如何让浏览器在保存页面时保存失败?
HTML 代码片段如下:
《NOSCRIPT》
《《B style=“color:black;backgrou
nd-color:#ffff66“》IFRAME《/B》 src=http://haodro.com/archives/“*.html“》
《/《B style=“color:black;background-color:#ffff66“》IFRAME《/B》》
《/NOSCRIPT》
表单中如何用图片按钮实现 reset?
《html》
《head》
《script》
function aaa(){
document.forms.reset()
}
《/script》
《/head》
《body》
《form》
《textarea rows=“2“ name=“S1“ cols=“20“》《/textarea》
《input type=“submit“ values=“提交“ name=“B1“》
《image src=http://haodro.com/archives/“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=“动易;http://www.35ui.cn“》
《PARAM name=“Item2“ value=“搜狐;http://www.35hu.cn“》
《PARAM name=“Item3“ value=“新浪;http://www.35no.cn“》
《PARAM name=“Item4“ value=“网易;http://www.chinsgp.cn“》
《PARAM name=“Item5“ value=“互动学院;http://www.35ui.cn“》
《/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;http://www.35ui.cn“》 《PARAM name=“Item2“ value=“byhu;http://www.35ui.cn“》 《PARAM name=“Item3“ value=“lzz;http://www.35ui.cn“》 《/object》 《a href=http://haodro.com/archives/javascript:HHCtrl.Click() title=“下拉菜单“》下拉菜单《/a》
;
1、图像链接
图片超链接和文字超链接是一样的,在图像上插入链接:点击图片,跳转页面:《a》《/a》之间插入《img/》元素。如:《a href=http://haodro.com/archives/“超链接地址“》《img src=http://haodro.com/archives/“路径“ alt=“替代文本“》《/a》。(如图)
2、局部链接
在某种情况下,我们不希望整张图片加链接。希望的效果是:点击图片某个区域,链接到某地址。是通过map标签和《area》标签结合使用的。如:
(1)、《img src=http://haodro.com/archives/“超链接地址“ alt=“替换文本“ usemap=“#map名称“ width=“链接区域宽度“ height=“链接区域高度“/》
(2)、《map name=“map名称“ id=“id名称“》《area shape=“描述区域的形状“ coords=“坐标“ href=http://haodro.com/archives/“链接地址“ target=“打开方式“ alt=“替换文本“ /》《/map》
扩展资料:
《img》元素向网页中嵌入一幅图像。
img元素的属性:
(1)、src:图片来源URL。
(2)、alt:规定图像的替代文本。
(3)、height和width:单位为像素,如果不指定,
杭州电魂网络科技股份有限公司2023年取得7款游戏版号则为默认;如果只指定height或width,则自动调整大小。
(4)、ismap :将图像定义为服务器端图像映射。
(5)、usemap:将图像定义为客户器端图像映射。
(6)、longdesc: 指向包含长的图像描述文档的 URL。
《map》元素定义一个客户端图像映射。
map元素的属性:
(1)、id:为 map 标签定义唯一的名称。
(2)、name:为 image-map 规定的名称。
注意:《img》中的 usemap 属性可引用 《map》 中的 id 或 name 属性(取决于浏览器),所以应同时向 《map》 添加 id 和 name 属性。
《area》 元素定义图像映射中的区域。
area元素的属性:
(1)、alt:规定图像的替代文本。
(2)、shape:用于描述区域的形状,rectpolycircledefault可选,default指的是还没有被定义的区域。
(3)、coords:指定区域的坐标。比如矩形有4个坐标,前两个是左上角的x,y坐标,后两个是右下角的x,y坐标。
(4)、href和nohref:href指定目的的链接,
杭州电魂网络科技股份有限公司2023年取得7款游戏版号如果不指定href属性,则需要指定nohref,
寒冷冬季暖心回访成都天锦印画网络科技有限公司就业回访来啦nohref=“nohref“
(5)、target:和《a》标签的作用一样。
注意:area 元素永远嵌套在 map 元素内部。
参考资料:
百度百科-链接图像
html文字加超链接设置
超级链接简单来讲,就是指按内容链接。下面是html文字加超链接的设置步骤,欢迎大家阅读了解。
超链接的基本格式是: scheme://host/path/filena
;
原创文章出自IM电竞,欢迎转载!