找了N个人(包括程序专业设计者) 居然搞不定一个JS 只是要求 在第一个标签 meta 后面 插入个超链接 没想到 看似简单的问题 多人竟然没搞定 具体看下面<!DOCTYPE html>
<!--STATUS OK-->
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
【只是要求必须在这个位置 插入一段超链接代码 竟然搞不定 郁闷至极】 <meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta content="always" name="referrer"> <meta name="theme-color" content="#2932e1">
<!--STATUS OK-->
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
【只是要求必须在这个位置 插入一段超链接代码 竟然搞不定 郁闷至极】 <meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta content="always" name="referrer"> <meta name="theme-color" content="#2932e1">
document.querySelector('meta').insertAdjacentHTML('afterend','<a href="http://www.baidu.com">百度</a>');这个地方就不该放这个东西啊
看页面元素是加进去了 只是没显示 为什么会有这种需求
document.querySelector('meta').insertAdjacentHTML('afterend','<a href="http://www.baidu.com">百度</a>');
document.querySelector('head').style.display='block';
这样
<!doctype html>
<html lang="en">
<head> <meta http-equiv="content-type" content="text/html;charset=utf-8">
<a href="123.html"></a>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta content="always" name="referrer">
<meta name="theme-color" content="#2932e1">
<title> 页面名称 </title>
<style type="text/css">
#div {}
</style>
</head>
<body>
</body>
</html>在浏览器中就会变成,a标签和它之后标签都移动到bosy中。
<html lang="en">
<head>
<title> 页面名称 </title>
</head>
<body>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta content="always" name="referrer">
<meta name="theme-color" content="#2932e1">
<script type="text/javascript">
document.getElementsByTagName('meta')[0].insertAdjacentHTML('afterend','<a href="http://www.baidu.com">百度</a>');
</script>
</body>
</html>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=gbk"><title>�������ؼ�-�����ֺ춹����ʪ�ۡ�</title>
</head><body link="#0000cc">
<a id="wei" href="http://163.com/" target="_self">�����ؼ�-�����ֺ춹����ʪ��</a>
面试的时候都特么要求写出遵循w3c的代码?
什么jb鬼需求