关于javascript:HTML-链接和图片

5次阅读

共计 15001 个字符,预计需要花费 38 分钟才能阅读完成。

广大无际的互联网世界!

a 标签

应用 a 标签就能够生成一个链接元素:

一起帮

a 标签自身并不难,难的是它应用的属性:

title

当鼠标悬停在 a 标签上时,浏览器会显示 title 指定的内容,给用户提醒_(对 SEO 也有帮忙)_

title 还能够利用在其余很多标签中,比方接下来要学习的 img……

target

批示如何关上 a 标签批示的网页:

  • _self:默认,在以后网页关上
  • _blank:在新的 tab 中关上

href

href 指定点击 a 标签应关上的网页地址。网址能够能够通过以下形式示意:

1)网址,即 URL,如:http://17bang.ren/Article/624。_(温习:网址的机密)_

这通常只用于指向(本)站(以)外的网页。

因为它蕴含了协定(http)和域名(17bang.ren),不够灵便。比方,咱们还在开发阶段,域名基本没有确定(用 localhost 代替),这时候该应用什么域名呢?难道咱们开发时应用 localhost,部署时再把 localhost 全副替换成 17bang.ren 吗?假如某一天咱们网站的域名又更换了呢?^_^

2)门路(Path),URL 中不蕴含协定和域名局部,比方:/Article/624。门路又能够分成两种:

  • 相对(Absolute)门路:它总是以斜杠(/)结尾,用斜杠代表根目录_(即以后我的项目的 wwwroot 文件夹)_,从根目录开始定位。飞哥 强烈 倡议 总是应用这种形式!
  • 绝对(Relative)门路:绝对于以后页面所在目录进行定位(仅供面试应用, 举荐这种形式),

    ./

    以后文件所在文件夹

    可省略

    ../

    以后文件所在文件夹的上一级

    ../../

    以后文件所在文件夹的上一级的再上一级

    假如以后页面门路为:/Article/yezi/A624

    1. href=”A236″:定位到以后文件夹下的 236 页面,即:/Article/yezi/A236
    2. Category-1/Index:定位到以后文件夹下的 Category- 1 文件夹下的 Index 页面,即:/Article/yezi/Category-1/Index
    3. href=”../Index”:定位到以后文件夹的上一级文件夹下的 Index 页面,即:/Article/Index
    4. href=”../../Problem”:定位到以后文件夹的上一级的再上一级文件夹下的 Problem 页面,即:/Problem

此外,网上还有另外一种基于 URL 的分类办法(称呼),对照表如下:

本文应用

其余分类

网址

相对 url

门路

绝对 URL

绝对路径

绝对根 URL

相对路径

绝对以后 URL

其余文件和 download

href 前面还能够指定非 html 的文件。

  • 如果指定的文件可能在浏览器中关上,默认主动关上,比方.txt;

    readme

  • 否则提醒下载,比方.dll 文件

    system

如果要浏览器可关上文件被下载,须要增加一个 download 属性:

readme

留神:基于平安思考,一些可执行文件(如.exe、.dll)会被禁止拜访 / 下载。

锚标记

在 href 指定的 URL 中能够增加井号“#”,比方:

email email

当点击这种链接时,浏览器会主动定位到 #后指定的“锚”地位。锚地位也是 a 标签,用 id 或 name 匹配:

email email

一起帮的 FAQ 中大量应用了锚标记。_(演示)_

HTML5 新用法

依据新的 HTML5 规范,href 中还能够放 email 地址、电话号码等

给飞哥一封 Email:2282636022@qq.com 给飞哥来个电话:18623051469

因为这种写法 须要浏览器反对,所以最好将 Email 地址和电话号码都体现进去,免得浏览器不反对时,用户无奈看到他们。

img 标签

可用于显示图片:

<img src=”/images/ 源栈广告.png” alt=” 源栈广告 ” title=” 大神小班,ASP.NET 全栈培训 ” />

图片的格局抉择:(温习:图片格式)

  • jpg/jpge:位图,可有损压缩
  • png:位图,无损压缩,可通明背景
  • gif:像素较低,可制作动图

属性

  • src:图片门路(起源:source)
  • alt:当图片无奈获取时的代替(alter)文字
  • title:同 a 标签,鼠标悬浮时显示

图片的要害是性能:压缩(个别是美工 /UI 去做)

作业

  1. 模仿常见问题页面,实现其内容页局部(只显示内容,练习:hX/a/hr,疏忽其余如图标 / 款式等)
  2. 参考如何取得帮帮点,实现外面的表格。而后将“注册”和“邀请注册”高低两格合并。(练习:表格绘制和行列合并)
  3. 浏览收看:源栈培训:性能索引 http://17bang.ren/Article/589
  4. 实现任一内容(求助 / 文章 / 意见建议)板块的列表页和单页的 HTML 内容,留神蕴含:

    1. 残缺的 html 文档构造(html/head/body)
    2. 页头 / 页脚 / 注释 / 侧边栏等(header/footer/article/aside)
    3. 题目 / 段落 / 图片 / 链接 / 强调 / 删除……等

https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…
http://github.com/hdfgfgh546/…
https://github.com/hdfgfgh546…
https://www.github.com/hdfgfg…

正文完
 0