链接在HTML的英文,英文:A链接标记ie下会自动补全href_HTML/Xhtml_网页制作

5268f80b9b1e01f982625ef6fac83ca1.png

英文:A链接标记ie下会自动补全href.

Whilst working on the Ajax Link Tracker and MapSurface I have come across an inconsistency in how the href attribute is retrieved using DOM Scripting.

The href attribute is different to other element attributes in that the value set can be relative to the context of the page URL. If you set a link with a relative href attribute

test page

The browser will look at the pages current URL and derive an absolute URL for the link.

http://www.glenn.jones.net/development/test1.html

This is the root of the problem, some browsers return the text of the attribute and others return the derived absolute URL. The results also differ by the method you use to retrieve the href attribute. There are three common ways to access an attribute:

linkobj.href;

linkobj[‘href’];

linkobj.getAttribute(‘href’);

The linkobj.href and linkobj[‘href’]; methods of accessing the attribute consistently return the derived absolute URL.

Microsoft has tried to address this by problem adding a second parameter to the getAttribute method. The second parameter can be set to 0,1 or 2. If the parameter is set to 2 the method returns the attribute text. Any other setting will return the derived absolute URL.

linkobj.getAttribute(‘href’);

linkobj.getAttribute(‘href’,2);

Derived

Absolute URL

Attribute Text

IE

linkobj.href;

x

IE

linkobj.getAttribute(‘href’);

x

IE

linkobj.getAttribute(‘href’,2);

x

Gecko

linkobj.href;

x

Gecko

linkobj.getAttribute(‘href’);

x

Gecko

linkobj.getAttribute(‘href’,2);

x

Opera

linkobj.href;

x

Opera

linkobj.getAttribute(‘href’);

x

Opera

linkobj.getAttribute(‘href’,2);

x

Get attribute test page Test on IE6, Firefox 1.5 and Opera 8.51.

So what should be returned by the getAttribute method? The W3C DOM Level 2 Core specification which sets out the structure of the getAttribute method does not cover this issue. It is not that either approach is wrong or right. On this point the specification is open to interpretation.

As a coder I would like to be able to access both values. The DOM Core specification should be updated to address the problem.

After a really good exchange with Jim in the comments below, I stand corrected. The specification does say the getAttribute should return the attribute value, not the absolute URL. The Microsoft approach is wrong.

For the time being I am using the old school object property method linkobj.href to return derived absolute URLs. It provides the most consistent results across all browsers.

URLs of interest

W3C REC DOM Level 2 Core specification for getAttribute

Gecko documentation for getAttribute

Microsoft documentation for getAttribute

As usual just as I was finishing this post I found this bug report on the QuickMode site which discusses the same subject.

getAttribute HREF is always absolute.html

1428d0e076c3959ab11d28a39bc84fab.png

5268f80b9b1e01f982625ef6fac83ca1.png

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:php中文网

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/267610.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

python实现文件加密

前言: 想实现批量文件加密,可惜批量。展时没有思路 0x1 没有加密前的图片 加密后!!! !!!打不开了 0x02: 代码 import hashlibdef get_sha1(f):xdopen(E:/1.txt,rb).read() #以读二进…

教徒计划出品:升级ESXI41-ESXI5

这个文档是教徒计划“教徒第一期”学员做的升级ESX41到ESXI5的资料,以后教徒计划学员做的资料共享时,我都会打上“教徒计划出品”字样,这样有别于“现任明教教主”出品。这样能够确认是谁主导做的这个事情。“教徒计划”这个平台能够给安全CC…

html是以一种通用的方法来,c++ 有一种通用的方法来使函数模板适应为多态函数对象吗?...

我有一些功能模板,例如template void foo(T);template void bar(T);// others我需要将每一个传递给一种算法,它将被称为各种类型的算法.template void some_algorithm(F f){// call f with argument of type int// call f with argument of type SomeClass// etc.}我不能传递我…

百度2011大会见闻:百度开始推出耀主页

9月2号是百度大会的日子&#xff0c;之前通过51CTO注册&#xff0c;获得了参会资格&#xff0c;感谢51CTO带来的机会&#xff0c;可以有幸到现场观看到百度总裁李彦宏的精彩演讲。<?xml:namespace prefix o ns "urn:schemas-microsoft-com:office:office" />…

asp.net core中使用log4net

和之前的ASP.NET MVC中的使用LOG4NET的方法有些不同&#xff0c;这里先记录一下&#xff0c;使用步骤如下 &#xff1a; 1. 建立 ASP.NET CORE项目中&#xff0c;NUGET中搜索log4net后下载安装 2. 根目录建立 log4net.config文件&#xff0c;内容如下&#xff1a; <?xml ve…

2013电大计算机应用基础试题及答案,[2017年电大]电大2013年计算机应用基础试题及答案[呕心沥血整理].doc...

[2017年电大]电大2013年计算机应用基础试题及答案[呕心沥血整理]计算机应用基础复习资料一、单选题1、当前的计算机一般被认为是第四代计算机&#xff0c;它所采用的逻辑元件是______。答案&#xff1a; DA&#xff1a;晶体管 B&#xff1a;集成电路 C&#xff1a;电子管 D&…

由于远程桌面服务当前正忙|VDI无法连接

VDI 无法连接&#xff0c;“由于远程桌面服务当前正忙”。Win2008 R2 DC RDVH RDCB RDWA &#xff0c;然后为用户demo配置了个人虚拟机&#xff08;XP SP3&#xff09;&#xff0c;当用户登录rdwa.abc.com/rdweb &#xff0c;访问“我的桌面”时一段时间后报错 “由于远程桌…

寒假作业01

1.对大一上学期的总结&#xff1a; 用一句很经典的话来说&#xff0c;大学生活与高中生活不同就在于高中忙着做作业是为了有时间去做其他的事&#xff0c;而在大学&#xff0c;得忙着做完其他事情才有时间去做作业。因为不仅要处理好学习内的事情&#xff0c;还要花心思在课余活…

单招计算机英语面试口语,英语面试口语对话技巧:教育背景

2021年高职单招升学一对一咨询高职单招袁老师:16623303056(微信)英语面试口语对话技巧:教育背景一、常见的英语面试对话1a&#xff1a;can you read and write english and german?你能用英语和德语读写吗&#xff1f;b&#xff1a;no, im proficient in both written and spo…

C代码中的命名方式总结和改进

宏全部使用大写字母--------宏大写结构体名字全部使用typedef&#xff0c;typedef之后的名字为大写-------结构体别名大写函数名全部使用小写字母&#xff0c;单词之间使用下划线分割-------函数名小写&#xff0c;单词之间下划线&#xff08;1&#xff09;函数名第一个单词全小…

linux 安装软件的几种方法

一、 解析Linux应用软件安装包&#xff1a;通常Linux应用软件的安装包有三种&#xff1a;1&#xff09; tar包&#xff0c;如software-1.2.3-1.tar.gz。它是使用UNIX系统的打包工具tar打包的。2&#xff09; rpm包&#xff0c;如software-1.2.3-1.i386.rpm。它是Redhat Linux提…

对计算机网络用户而言 掌握网络,计算机网络的特点

1、可靠性在一个网络系统中&#xff0c;当一台计算机出现故障时&#xff0c;可立即由系统中的另一台计算机来代替其完成所承担的任务。同样&#xff0c;当网络的一条链路出了故障时可选择其它的通信链路进行连接。2、高效性计算机网络系统摆脱了中心计算机控制结构数据传输的局…

Bootstrap-CSS:表格

ylbtech-Bootstrap-CSS&#xff1a;表格1.返回顶部 1、Bootstrap 表格 Bootstrap 提供了一个清晰的创建表格的布局。下表列出了 Bootstrap 支持的一些表格元素&#xff1a; 标签描述<table>为表格添加基础样式。<thead>表格标题行的容器元素&#xff08;<tr>…

Oracle找出需要建立索引的表

文章讨论的是本来应该建立索引而因为疏忽&#xff0c;或者考虑不周全而没有建立的情况 select distinct sp.OBJECT_NAME,round(ds.bytes/1024/1024,2) MB,num_rows,last_analyzed from v$sql_plan sp ,v$sqlarea sq,dba_segments ds,dba_tables dt where sq.ADDRESSsp.ADDRESS …

石油采集(求联通区域) 2018多校寒假集训 (dfs+二分匹配)

题目&#xff1a; 链接&#xff1a;https://www.nowcoder.com/acm/contest/76/A来源&#xff1a;牛客网 随着海上运输石油泄漏的问题&#xff0c;一个新的有利可图的行业正在诞生&#xff0c;那就是撇油行业。如今&#xff0c;在墨西哥湾漂浮的大量石油&#xff0c;吸引了许多商…

Struts1 处理接收参数插入到数据库之后呈乱码的问题解决

Struts处理接收参数乱码问题&#xff08;actionForm接受的参数发送至数据库成乱码&#xff09;的解决办法: 第一步&#xff1a; 新建一个类如&#xff1a;EncodingActionServlet 继承 ActionServlet 覆盖父类process()方法代码如下&#xff1a;package com.aptech.jb.epet.we…

计算机nit题百度云,计算机NIT应用基础试题

一、 填空题(25分)文章地址&#xff1a;https://www.llysc.cn/content/24-24873.html1、完整的计算机由硬件系统 和软件系统 两大部件组成的。3、存储器可分为内存储器 和外存储器 两类。4、微型计算机硬件系统一般应包括主机、键盘、鼠标和显示器 。5、通过鼠标的基本操作方法…

前端(2)CSS

css&#xff1a;Cascading Style Sheet 层叠样式表——修饰、美化网页&#xff0c;化妆师CSS优先级&#xff0c;即是指CSS样式在浏览器中被解析的先后顺序。行间样式 > 内嵌css样式 > 外链css样式&#xff08;在style之前引入&#xff09;如果外链css样式在style之后引入…

某计算机公司的库存管理,《管理系统中计算机应用》应用题数据流程图汇总题及参考答案...

《管理系统中计算机应用》应用题及参考答案——数据流程图1、教学管理的主要工作过程是&#xff1a;系办(公室)输入班级和教学时间&#xff0c;查看教学计划表&#xff0c;确定本学期教学任务&#xff1b;根据本学期教学任务&#xff0c;查看教师表&#xff0c;制作开课任务书和…

perl命令行参数

查看perl版本 perl -version 对脚本进行语法检查 perl -c scriptname.pl&#xff0c;比如 perl -c zdd.pl对zdd.pl进行语法检查&#xff0c;并不执行。 调试perl脚本 perl -d script.pl 执行命令 perl -e print "hellow, world!\n" 注意&#xff0c;在Windows上-e后面…