十行HTML已毕夯完成实,Highcharts翻译体系之十九

十行HTML达成坚落成实

2017/06/11 · HTML5 · 1
评论

本文由 伯乐在线 –
一杯哈希不加盐
翻译,艾凌风
校稿。未经许可,禁止转发!
英文出处:Alexandra
Etienne。欢迎出席翻译组。

您想经过互连网完结做达成实吗?现在你只要求 10 行 HTML
代码!真的!让自身带你看一看代码,相当简单。

大家方今发表了AR.js。你不必要设置任何利用,用你的无绳电话机通过网络就能感受到无敌的加强现实。但让大家更进一步,看一下怎么让你也撰文出自己的提升现实经验。多亏了神奇的a-frame,最短的
AR.js 只有 10 行 HTML
代码。你可以在codepen总的来看在线版:

XHTML

<!– Augmented Reality on the Web in 10 lines of html!
–> <script
src=”;
<script
src=”;
<script>THREEx.ArToolkitContext.baseURL =
‘;
<body style=’margin : 0px; overflow: hidden;’> <a-scene
embedded artoolkit=’sourceType: webcam;’> <a-box position=’0 0.5
0′ material=’opacity: 0.5;’></a-box> <a-marker-camera
preset=’hiro’></a-marker-camera> </a-scene> </body>

1
2
3
4
5
6
7
8
9
10
<!– Augmented Reality on the Web in 10 lines of html! https://github.com/jeromeetienne/ar.js –>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="https://rawgit.com/jeromeetienne/ar.js/master/aframe/build/aframe-ar.js"></script>
<script>THREEx.ArToolkitContext.baseURL = ‘https://rawgit.com/jeromeetienne/ar.js/master/three.js/'</script>
<body style=’margin : 0px; overflow: hidden;’>
    <a-scene embedded artoolkit=’sourceType: webcam;’>
        <a-box position=’0 0.5 0′ material=’opacity: 0.5;’></a-box>
        <a-marker-camera preset=’hiro’></a-marker-camera>
    </a-scene>
</body>

俺们来一行一行看.

您想透过互联网完成加强现实吗?现在你只须求 10 行 HTML
代码!真的!让自己带你看一看代码,至极不难。

第三章 jQuery中的DOM操作,jquerydom

  DOM(Document Object
Model)文档对象模型,每张网页都能用DOM表示出来,每一份DOM都能作为一颗DOM树。

  jQuery继承了JavaScript对DOM对象操作的特征,使开发人士能有益地操作DOM对象。

  1.查找节点

亚洲必赢官网 1<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ /> <title>3-1</title>
<!– 引入jQuery –> <script src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function () { var $para =
$(“p”); // 获取<p>节点 var p_txt = $para.attr(“title”); //
获取<p>元素节点属性title alert(p_txt); var $li = $(“ul
li:eq(1)”); // 获取首个<li>元素节点 var ul_txt =
$li.attr(“title”); //
获取<ul>里的第三个<li>元素节点的质量title var li_txt =
$li.text(); // 获取第一个<li>元素节点的text alert(ul_txt);
alert(li_txt); }); //]]> </script> </head>
<body> <p title=”接纳你最欢快的水果.”
>你最欣赏的瓜果是?</p> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code

  2.创办节点

亚洲必赢官网 2<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-2-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li_1 =
$(“<li></li>”); // 成立首个<li>元素 var $li_2 =
$(“<li></li>”); // 创立第三个<li>元素 var $parent =
$(“ul”); // 获取<ul>节点,<li>的父节点
$parent.append($li_1); // 添加到<ul>节点中,使之能在网页中呈现$parent.append($li_2); //
可以采用链式写法:$parent.append($li_1).append($li_2); }); //]]>
</script> </head> <body> <p
title=”选用你最喜悦的水果.” >你最欣赏的水果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 3<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-2-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li_1 =
$(“<li>香蕉</li>”); //
创制一个<li>元素,包含元素节点和文件节点
//“香蕉”就是创造的文书节点。 var $li_2 =
$(“<li>雪梨</li>”); //
成立一个<li>元素,包蕴元素节点和文件节点
//“雪梨”就是成立的文书节点。 var $parent = $(“ul”); //
获取<ul>节点。<li>的父节点 $(“ul”).append($li_1); //
添加到<ul>节点中,使之能在网页中体现 $(“ul”).append($li_2); //
添加到<ul>节点中,使之能在网页中显得 }); //]]>
</script> </head> <body> <p
title=”选用你最欣赏的水果.” >你最欣赏的水果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 4<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-2-3</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li_1 =
$(“<li title=’香蕉’>香蕉</li>”); //创制一个<li>元素
//包蕴元素节点,文本节点和质量节点 //其中title=’香蕉’ 就是创设的品质节点
var $li_2 = $(“<li title=’雪梨’>雪梨</li>”);
//创设一个<li>元素 //包涵元素节点,文本节点和特性节点
//其中title=’雪梨’ 就是创立的特性节点 var $parent = $(“ul”); //
获取<ul>节点。<li>的父节点 $parent.append($li_1); //
添加到<ul>节点中,使之能在网页中显得 $parent.append($li_2); //
等价于:$parent.append($li_1).append($li_2); }); //]]>
</script> </head> <body> <p
title=”接纳你最欣赏的水果.” >你最欣赏的果品是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  3.插入节点

亚洲必赢官网 5<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-3-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li_1 =
$(“<li title=’香蕉’>香蕉</li>”); // 成立第二个<li>元素
var $li_2 = $(“<li title=’雪梨’>雪梨</li>”); //
创建首个<li>元素 var $li_3 = $(“<li
title=’别的’>别的</li>”); // 创造第多少个<li>元素 var
$parent = $(“ul”); // 获取<ul>节点,即<li>的父节点 var
$two_li = $(“ul li:eq(1)”); //
获取<ul>节点中第四个<li>元素节点 $parent.append($li_1); //
append方法将开创的率先个<li>元素添加到父元素的末梢面
$parent.prepend($li_2); //
prepend方法将创制的第一个<li>元素添加到父元素里的最前面$li_3.insertAfter($two_li); //
insertAfter方法将开创的第八个<li>元素元素插入到收获的<li>之后
}); //]]> </script> </head> <body> <p
title=”选拔你最喜爱的水果.” >你最欢娱的鲜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 6<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-3-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $one_li =
$(“ul li:eq(1)”); // 获取<ul>节点中第一个<li>元素节点 var
$two_li = $(“ul li:eq(2)”); //
获取<ul>节点中第八个<li>元素节点
$two_li.insertBefore($one_li); //移动节点 }); //]]>
</script> </head> <body> <p
title=”选取你最欣赏的水果.” >你最喜爱的果品是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  4.剔除节点

亚洲必赢官网 7<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-4-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ $(“ul
li:eq(1)”).remove(); //
获取第三个<li>元素节点后,将它从网页中删除。 }); //]]>
</script> </head> <body> <p
title=”拔取你最欣赏的水果.” >你最喜爱的鲜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 8<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-4-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li =
$(“ul li:eq(1)”).remove(); //
获取第一个<li>元素节点后,将它从网页中除去。 $li.appendTo(“ul”);
// 把刚刚去除的又再次添加到<ul>元素里
//所以,删除只是从网页中剔除,在jQuery对象中,这些因素仍旧存在的,大家可以再一次得到它
}); //]]> </script> </head> <body> <p
title=”选用你最喜爱的水果.” >你最欢跃的鲜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 9<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-4-3</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ $(“ul
li”).remove(“li[title!=菠萝]”);
//把<li>元素中属性title不等于”菠萝”的<li>元素删除 });
//]]> </script> </head> <body> <p
title=”接纳你最喜爱的水果.” >你最欢腾的水果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 10<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-4-4</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ $(“ul
li:eq(1)”).empty(); //
找到首个<li>元素节点后,清空此因素里的内容 }); //]]>
</script> </head> <body> <p
title=”选拔你最喜爱的水果.” >你最欢腾的水果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  5.复制节点

亚洲必赢官网 11<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-5-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> $(function(){ $(“ul li”).click(function(){
$(this).clone().appendTo(“ul”); //
复制当前点击的节点,并将它追加到<ul>元素 }) }); </script>
</head> <body> <p title=”拔取你最喜爱的水果.”
>你最欢娱的水果是?</p> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code
亚洲必赢官网 12<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-5-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> $(function(){ $(“ul li”).click(function(){
$(this).clone(true).appendTo(“ul”); // 注意参数true
//能够复制自己,并且他的副本也有相同听从。 }) }); </script>
</head> <body> <p title=”选拔你最喜爱的水果.”
>你最欢腾的水果是?</p> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code

  6.替换节点

亚洲必赢官网 13<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ /> <title>3-6</title>
<!– 引入jQuery –> <script src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“p”).replaceWith(“<strong>你最不欣赏的鲜果是?</strong>”);
// 同样的完结:
$(“<strong>你最不喜欢的果品是?</strong>”).replaceAll(“p”);
}); //]]> </script> </head> <body> <p
title=”接纳你最喜爱的水果.” >你最欢悦的瓜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  7.包裹节点

亚洲必赢官网 14<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-7-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“strong”).wrap(“<b></b>”);//用<b>元素把<strong>元素包裹起来
}); //]]> </script> </head> <body> <strong
title=”选用你最开心的水果.” >你最欣赏的果品是?</strong>
<ul> <li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 15<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-7-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“strong”).wrap(“<b></b>”); }); //]]> </script>
</head> <body> <strong title=”选用你最欢愉的水果.”
>你最欣赏的水果是?</strong> <strong
title=”接纳你最喜爱的水果.” >你最欢快的鲜果是?</strong>
<ul> <li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 16<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-7-3</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“strong”).wrapAll(“<b></b>”); }); //]]>
</script> </head> <body> <strong
title=”选用你最欣赏的水果.” >你最欣赏的水果是?</strong>
<strong title=”接纳你最快乐的水果.”
>你最欣赏的鲜果是?</strong> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code
亚洲必赢官网 17<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-7-4</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“strong”).wrapInner(“<b></b>”); }); //]]>
</script> </head> <body> <strong
title=”选拔你最欢乐的水果.” >你最欣赏的果品是?</strong>
<ul> <li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  8.属性操作

亚洲必赢官网 18<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ /> <title>3-8</title>
<!– 引入jQuery –> <script src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//设置<p>元素的习性’title’ $(“input:eq(0)”).click(function(){
$(“p”).attr(“title”,”拔取你最欣赏的水果.”); });
//获取<p>元素的性质’title’ $(“input:eq(1)”).click(function(){
alert( $(“p”).attr(“title”) ); }); //删除<p>元素的属性’title’
$(“input:eq(2)”).click(function(){ $(“p”).removeAttr(“title”); }); });
//]]> </script> </head> <body> <input
type=”button” value=”设置<p>元素的习性’title'”/> <input
type=”button” value=”获取<p>元素的属性’title'”/> <input
type=”button” value=”删除<p>元素的性质’title'”/> <p
title=”拔取你最喜爱的水果.” >你最喜爱的果品是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  9.样式操作

亚洲必赢官网 19<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-9-1</title> <style type=”text/css”> .high{
font-weight:bold; /* 粗体字 */ color : red; /* 字体颜色设置灰色*/ }
.another{ font-style:italic; color:blue; } </style> <!–
引入jQuery –> <script src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function () { //获取样式
$(“input:eq(0)”).click(function () { alert($(“p”).attr(“class”)); });
//设置样式 $(“input:eq(1)”).click(function () { $(“p”).attr(“class”,
“high”); }); //追加样式 $(“input:eq(2)”).click(function () {
$(“p”).addClass(“another”); }); //删除全部体制
$(“input:eq(3)”).click(function () { $(“p”).removeClass(); });
//删除指定样式 $(“input:eq(4)”).click(function () {
$(“p”).removeClass(“high”); }); //重复切换样式
$(“input:eq(5)”).click(function () { $(“p”).toggleClass(“another”); });
//判断元素是或不是包罗某样式 $(“input:eq(6)”).click(function () {
alert($(“p”).hasClass(“another”)); alert($(“p”).is(“.another”)); //同上
}); }); //]]> </script> </head> <body> <input
type=”button” value=”输出class类”/> <input type=”button”
value=”设置class类”/> <input type=”button”
value=”追加class类”/> <input type=”button”
value=”删除所有class类”/> <input type=”button”
value=”删除指定class类”/> <input type=”button”
value=”重复切换class类”/> <input type=”button”
value=”判断元素是不是包罗某个class类”/> <p class=”myClass”
title=”接纳你最欣赏的水果.” >你最欣赏的果品是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  10.装置获取HTML,文本和值

亚洲必赢官网 20<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-1</title> <style type=”text/css”> .test{
font-weight:bold; color : red; } .add{ font-style:italic; }
</style> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//获取<p>元素的HTML代码 $(“input:eq(0)”).click(function(){ alert(
$(“p”).html() ); }); //获取<p>元素的文书
$(“input:eq(1)”).click(function(){ alert( $(“p”).text() ); });
//设置<p>元素的HTML代码 $(“input:eq(2)”).click(function(){
$(“p”).html(“<strong>你最喜悦的影视是?</strong>”); });
//设置<p>元素的公文 $(“input:eq(3)”).click(function(){
$(“p”).text(“你最欣赏的名士是?”); }); //设置<p>元素的公文
$(“input:eq(4)”).click(function(){
$(“p”).text(“<strong>你最喜爱的嬉戏是?</strong>”); });
//获取按钮的value值 $(“input:eq(5)”).click(function(){ alert(
$(this).val() ); }); //设置按钮的value值
$(“input:eq(6)”).click(function(){ $(this).val(“我被点击了!”); }); });
//]]> </script> </head> <body> <input
type=”button” value=”获取<p>元素的HTML代码”/> <input
type=”button” value=”获取<p>元素的文书”/> <input
type=”button” value=”设置<p>元素的HTML代码”/> <input
type=”button” value=”设置<p>元素的文件”/> <input
type=”button” value=”设置<p>元素的文本(带HTML)”/> <input
type=”button” value=”获取按钮的value值”/> <input type=”button”
value=”设置按钮的value值”/> <p title=”选取你最兴奋的水果.”
><strong>你最欣赏的鲜果是?</strong></p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 21<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-2-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“#address”).focus(function(){ // 地址框得到鼠标主旨 var txt_value =
$(this).val(); // 得到当前文本框的值 if(txt_value==”请输入邮箱地址”){
$(this).val(“”); // 假诺符合条件,则清空文本框内容 } });
$(“#address”).blur(function(){ // 地址框失去鼠标宗旨 var txt_value =
$(this).val(); // 获得当前文本框的值 if(txt_value==””){
$(this).val(“请输入邮箱地址”);// 假若符合条件,则设置情节 } })
$(“#password”).focus(function(){ var txt_十行HTML已毕夯完成实,Highcharts翻译体系之十九。value = $(this).val();
if(txt_value==”请输入邮箱密码”){ $(this).val(“”); } });
$(“#password”).blur(function(){ var txt_value = $(this).val();
if(txt_value==””){ $(this).val(“请输入邮箱密码”); } }) }); //]]>
</script> </head> <body> <input type=”text”
id=”address” value=”请输入邮箱地址”/> <br/><br/>
<input type=”text” id=”password” value=”请输入邮箱密码”/>
<br/><br/> <input type=”button” value=”登陆”/>
</body> </html> View
Code
亚洲必赢官网 22<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-2-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function () {
$(“#address”).focus(function () { // 地址框获得鼠标宗旨 var txt_value
= $(this).val(); // 获得当前文本框的值 if (txt_value ==
this.defaultValue) { $(this).val(“”); // 若是符合条件,则清空文本框内容
} }); $(“#address”).blur(function () { // 地址框失去鼠标主旨 var
txt_value = $(this).val(); // 得到当前文本框的值 if (txt_value == “”)
{ $(this).val(this.defaultValue); // 如若符合条件,则设置情节 } })
$(“#password”).focus(function () { var txt_value = $(this).val(); if
(txt_value == this.defaultValue) { $(this).val(“”); } });
$(“#password”).blur(function () { var txt_value = $(this).val(); if
(txt_value == “”) { $(this).val(this.defaultValue); } }) }); //]]>
</script> </head> <body> <input type=”text”
id=”address” value=”请输入邮箱地址”/> <br/><br/>
<input type=”text” id=”password” value=”请输入邮箱密码”/>
<br/><br/> <input type=”button” value=”登陆”/>
</body> </html> View
Code
亚洲必赢官网 23<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-3</title> <style type=”text/css”> .test{
font-weight:bold; color : red; } .add{ font-style:italic; }
</style> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//设置单选下拉框选中 $(“input:eq(0)”).click(function(){
$(“#single”).val(“拔取2号”); }); //设置多选下拉框选中
$(“input:eq(1)”).click(function(){ $(“#multiple”).val([“选择2号”,
“选择3号”]); }); //设置单选框和多选框选中
$(“input:eq(2)”).click(function(){
$(“:checkbox”).val([“check2″,”check3”]);
$(“:radio”).val([“radio2″]); }); }); //]]> </script>
</head> <body> <input type=”button”
value=”设置单选下拉框选中”/> <input type=”button”
value=”设置多选下拉框选中”/> <input type=”button”
value=”设置单选框和多选框选中”/> <br/><br/> <select
id=”single”> <option>选取1号</option>
<option>选拔2号</option>
<option>拔取3号</option> </select> <select
id=”multiple” multiple=”multiple” style=”height:120px;”> <option
selected=”selected”>拔取1号</option>
<option>选拔2号</option>
<option>选用3号</option>
<option>选拔4号</option> <option
selected=”selected”>选用5号</option> </select>
<br/><br/> <input type=”checkbox” value=”check1″/>
多选1 <input type=”checkbox” value=”check2″/> 多选2 <input
type=”checkbox” value=”check3″/> 多选3 <input type=”checkbox”
value=”check4″/> 多选4 <br/> <input type=”radio”
value=”radio1″/> 单选1 <input type=”radio” value=”radio2″/>
单选2 <input type=”radio” value=”radio3″/> 单选3 </body>
</html> View Code
亚洲必赢官网 24<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-4</title> <style type=”text/css”> .test{
font-weight:bold; color : red; } .add{ font-style:italic; }
</style> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//设置单选下拉框选中 $(“input:eq(0)”).click(function(){ $(“#single
option”).removeAttr(“selected”); //移除属性selected $(“#single
option:eq(1)”).attr(“selected”,true); //设置属性selected });
//设置多选下拉框选中 $(“input:eq(1)”).click(function(){ $(“#multiple
option”).removeAttr(“selected”); //移除属性selected $(“#multiple
option:eq(2)”).attr(“selected”,true);//设置属性selected $(“#multiple
option:eq(3)”).attr(“selected”,true);//设置属性selected });
//设置单选框和多选框选中 $(“input:eq(2)”).click(function(){
$(“:checkbox”).removeAttr(“checked”); //移除属性checked
$(“:radio”).removeAttr(“checked”); //移除属性checked
$(“[value=check2]:checkbox”).attr(“checked”,true);//设置属性checked
$(“[value=check3]:checkbox”).attr(“checked”,true);//设置属性checked
$(“[value=radio2]:radio”).attr(“checked”,true);//设置属性checked });
}); //]]> </script> </head> <body> <input
type=”button” value=”设置单选下拉框选中”/> <input type=”button”
value=”设置多选下拉框选中”/> <input type=”button”
value=”设置单选框和多选框选中”/> <br/><br/> <select
id=”single”> <option>选取1号</option>
<option>选取2号</option>
<option>接纳3号</option> </select> <select
id=”multiple” multiple=”multiple” style=”height:120px;”> <option
selected=”selected”>接纳1号</option>
<option>选取2号</option>
<option>拔取3号</option>
<option>接纳4号</option> <option
selected=”selected”>选择5号</option> </select>
<br/><br/> <input type=”checkbox” value=”check1″/>
多选1 <input type=”checkbox” value=”check2″/> 多选2 <input
type=”checkbox” value=”check3″/> 多选3 <input type=”checkbox”
value=”check4″/> 多选4 <br/> <input type=”radio”
value=”radio1″ name=”a”/> 单选1 <input type=”radio” value=”radio2″
name=”a”/> 单选2 <input type=”radio” value=”radio3″ name=”a”/>
单选3 </body> </html> View Code

  11.遍历节点

亚洲必赢官网 25<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-11-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $body =
$(“body”).children(); var $p = $(“p”).children(); var $ul =
$(“ul”).children(); alert( $body.length ); //
<body>元素下有2个子元素 alert( $p.length ); //
<p>元素下有0个子元素 alert( $ul.length ); //
<p>元素下有3个子元素 for(var i=0;i< $ul.length;i++){ alert(
$ul[i].innerHTML ); } }); //]]> </script> </head>
<body> <p title=”选择你最快乐的水果.”
>你最欣赏的水果是?</p> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code
亚洲必赢官网 26<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-11-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $p1 =
$(“p”).next(); alert( $p1.html() ); // 紧邻<p>元素后的同辈元素 var
$ul = $(“ul”).prev(); alert( $ul.html() ); //
紧邻<ul>元素前的同辈元素 var $p2 = $(“p”).siblings(); alert(
$p2.html() ); // 紧邻<p>元素的绝无仅有同辈元素 }); //]]>
</script> </head> <body> <p
title=”拔取你最喜爱的水果.” >你最喜爱的鲜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
亚洲必赢官网 27<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-11-3</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function () {
$(document).bind(“click”, function (e) {
$(e.target).closest(“li”).css(“color”, “red”); }) }); //]]>
</script> </head> <body> <p
title=”接纳你最喜爱的水果.” >你最欢悦的鲜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  12.CSS-DOM操作

亚洲必赢官网 28<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-12-1</title> <style type=”text/css”> .test{
font-weight:bold; color : red; } .add{ font-style:italic; }
</style> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//获取<p>元素的color $(“input:eq(0)”).click(function(){ alert(
$(“p”).css(“color”) ); }); //设置<p>元素的color
$(“input:eq(1)”).click(function(){ $(“p”).css(“color”,”red”) });
//设置<p>元素的fontSize和backgroundColor
$(“input:eq(2)”).click(function(){ $(“p”).css({“fontSize”:”30px”
,”backgroundColor”:”#888888″}) }); //获取<p>元素的惊人
$(“input:eq(3)”).click(function(){ alert( $(“p”).height() ); });
//获取<p>元素的宽窄 $(“input:eq(4)”).click(function(){ alert(
$(“p”).width() ); }); //获取<p>元素的惊人
$(“input:eq(5)”).click(function(){ $(“p”).height(“100px”); });
//获取<p>元素的拉长率 $(“input:eq(6)”).click(function(){
$(“p”).width(“400px”); }); //获取<p>元素的的左侧距和上边距
$(“input:eq(7)”).click(function(){ var offset = $(“p”).offset(); var
left = offset.left; var top = offset.top;
alert(“left:”+left+”;top:”+top); }); }); //]]> </script>
</head> <body> <input type=”button”
value=”获取<p>元素的color”/> <input type=”button”
value=”设置<p>元素的color”/> <input type=”button”
value=”设置<p>元素的fontSize和backgroundColor”/> <input
type=”button” value=”获取<p>元素的可观”/> <input
type=”button” value=”获取<p>元素的升幅”/> <input
type=”button” value=”设置<p>元素的莫大”/> <input
type=”button” value=”设置<p>元素的宽窄”/> <input
type=”button” value=”获取<p>元素的的右边距和上边距”/> <p
title=”选取你最喜爱的水果.”><strong>你最欢腾的果品是?</strong></p>
<ul> <li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

 PS:参考文献《锋利的jQuery》

Highcharts翻译体系之十九:曲线图例子(1)
 

引入库

XHTML

<script
src=”;
<script
src=”;
<script>THREEx.ArToolkitContext.baseURL =
‘;

1
2
3
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="https://rawgit.com/jeromeetienne/ar.js/master/aframe/build/aframe-ar.js"></script>
<script>THREEx.ArToolkitContext.baseURL = ‘https://rawgit.com/jeromeetienne/ar.js/master/three.js/'</script>

首先,你要求引入a-frame,一款MozillaVR引领的付出
VR 体验的利器。A-frame 包括了 three.js。然后您只须求为 a-frame 引入
AR.js。AR.js能让 AR 中的 3d 突显在您的手机上高速运行,哪怕是 2、3
年前的旧手机。

俺们方今公告了AR.js。你不须要安装其余利用,用你的无绳电话机通过互联网就能体验到无敌的滋长现实。但让我们更进一步,看一下怎么样让你也撰写出团结的压达成实体验。多亏了神奇的a-frame,最短的
AR.js唯有10行HTML 代码。

对此jquery一些难题

哇哦,我帮您写代码:
<script type=”text/javascript”>
$(function(){
$(“.has_children”).click(function(){
$(this).addClass(“highlight”)
.children(“a”).show().end()
.siblings().removeClass(“highlight”)
.children(“a”).hide();
});

});

代码:

定义 Body

XHTML

<body style=’margin : 0px; overflow: hidden;’> <!– … –>
</body>

1
2
3
<body style=’margin : 0px; overflow: hidden;’>
    <!– … –>
</body>

这一步,国际惯例。似乎你在具有 HTML 页面中做的均等,定义 body。

亚洲必赢官网 29

</script>

看出来去其余吧?一定要加在:
$(function(){ })
的函数内。

你之所以没意义,是因为您绑定事件的时候 ,dom 节点根本不存在。
而 $(function(){ }) 这一个函数的情致是,当 所有 html

[html]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> 
<html> 
<head> 
    <title>重量曲线图</title> 
    <script type=”text/javascript”
src=”Lib/Scripts/jquery-1.7.2.min.js”></script> 
    <script type=”text/javascript”> 
        $(function () { 
            var splinechart; 
            $(document).ready(function () { 
                splinechart = new Highcharts.Chart({ 
                    chart: { 
                        renderTo: ‘splineContainer’, 
                        type: ‘spline’, 
                        margin: [25, 30, 70, 50] 
                    }, 
                    title: { 
                        text: ‘体重’, 
                        x: 50, 
                        y: 10, 
                        style: { 
                            display: ‘none’ 
                        } 
                    }, 
                    color: [ 
                    ‘#006ebe’ 
                    ], 
                    subtitle: { 
                        style: { 
                            display: ‘none’ 
                        } 
                    }, 
                    xAxis: { 
                        lineWidth: 1, 
                        lineColor: ‘#dfe7ef’, 
                        gridLineWidth: 0, 
                        lineColor: ‘#000000’, 
                        startOnTick: true, 
                        tickPixelInterval: 110, 
                        type: ‘datetime’, 
                        labels: { 
                            rotation: -45, 
                            y: 40, 
                            style: { 
                                color: ‘#000000’, 
                                fontSize: ‘8px’, 
                                fontWeight: ‘normal’ 
 
                            } 
                        }, 
                        tickColor: ‘#000000’, 
                        tickLength: 5, 
                        tickWidth: 1, 
                        dateTimeLabelFormats: { 
                            day: ‘%Y-%m-%d’, 
                            week: ‘%Y-%m-%d’, 
                            month: ‘%Y-%m-%d’, 
                            year: ‘%Y-%m-%d’ 
                        }, 
                        title: { 
                            style: 
                      { 
                          display: ‘none’ 
                      } 
                        } 
 
                    }, 
              yAxis: { 
                        allowDecimals: true, 
                        startOnTick: true, 
                        endOnTick: true, 
                        lineWidth: 1, 
                        gridLineWidth:0, 
                        gridLineColor: ‘#d3d3d3’, 
                        lineColor: ‘#000000’, 
                        tickColor: ‘#000000’, 
                        tickLength: 5, 
                        tickWidth: 1, 
                        title: { 
                            text: ‘重量(kg)’, 
                            style: { 
                                color: ‘#02528b’, 
                                fontSize: ’12px’, 
                                fontWeight: ‘normal’ 
 
                            } 
                        }, 
                        labels: { 
                            style: { 
                                color: ‘#000000’, 
                                fontSize: ’10px’, 
                                fontWeight: ‘normal’ 
                            } 
                        } 
                    }, 
                    legend: { 
                        layout: ‘horizontal’, 
                        backgroundColor: ‘#ffffff’, 
                        align: ‘right’, 
                        verticalAlign: ‘top’, 
                        x: 0, 
                        y: -10, 
                        floating: true, 
                        shadow: false, 
                        borderWidth: 0 
                    }, 
                    tooltip: { 
                        shared: true, 
                        crosshairs: true 
                    }, 
                    plotOptions: { 
                        spline: { 
                            shadow: false, 
                            animation: false, 
                            lineWidth: 1 
                        }, 
                        series: { 
                            color: ‘#000000’, 
                            marker: { 
                                enabled: true, 
                                fillColor: ‘#006ebe’, 
                                lineWidth: 1, 
                                lineColor: ‘#006ebe’, 
                                radius: 3 
                            } 
                        } 
                    }, 
                    series: [{ 
                        name: ‘重量’, 
                        data: [[Date.UTC(2012, 9, 8, 10, 22, 00),
88.8], [Date.UTC(2012, 9, 10, 10, 22, 00), 87.9], [Date.UTC(2012, 9,
13, 10, 00, 00), 87.4], [Date.UTC(2012, 9, 14, 12, 05), 87.2],
[Date.UTC(2012, 9, 16, 10, 00, 00), 87.2], [Date.UTC(2012, 9, 18, 10,
00, 00), 86.8], [Date.UTC(2012, 9, 22, 10, 00, 00), 86.5],
[Date.UTC(2012, 9, 25, 10, 00, 00), 86.5], [Date.UTC(2012, 9, 30, 10,
00, 00), 86.4]], 
                        dataLabels: { 
                            enabled: true 
                        } 
 
                    }] 
 
                }); 
            }); 
 
        }); 
    </script> 
</head> 
<body> 
    <script src=”Lib/Highcharts-2.2.5/js/highcharts.js”
type=”text/javascript”></script> 
    <!– <script
src=”../../js/modules/exporting.js”></script>–> 
    <div id=”bg” style=”margin: 0; padding: 0;”> 
        <div style=”width: 736px; margin: 0 auto; height: 27px;
line-height: 27px; font-family: Microsoft YaHei; 
            font-size: 14px”> 
            <span style=”color:
#006ebd;”>体重曲线图:</span><span style=”font-size: 14px;
color: #000000;”>单位[kg]</span></div> 
        <div id=”splineContainer” style=”width: 736px; height: 310px;
margin: 0 auto; padding-bottom: 10px; 
            border-bottom: 1px dashed #9b9b9b;”> 
        </div> 
    </div> 
</body> 
</html> 

创建 3d 场景

XHTML

<a-scene embedded artoolkit=’sourceType: webcam;’> <!– put
your 3d content here –> </a-scene>

1
2
3
<a-scene embedded artoolkit=’sourceType: webcam;’>
    <!– put your 3d content here –>
</a-scene>

下一场,大家就要创造大家的 a-farme 场景。我们本来也急需投入 ARToolkit
组件。ARToolkit是一个开源库,大家透过它来落到实处视频头定位。

引入库

文件加载渲染完成的时候,才起来举行。

^_* ,那样可以设为最佳了啊?谢谢啊
 

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<html>
<head>
    <title>重量曲线图</title>
    <script type=”text/javascript”
src=”Lib/Scripts/jquery-1.7.2.min.js”></script>
    <script type=”text/javascript”>
        $(function () {
            var splinechart;
            $(document).ready(function () {
                splinechart = new Highcharts.Chart({
                    chart: {
                        renderTo: ‘splineContainer’,
                        type: ‘spline’,
                        margin: [25, 30, 70, 50]
                    },
                    title: {
                        text: ‘体重’,
                        x: 50,
                        y: 10,
                        style: {
                            display: ‘none’
                        }
                    },
                    color: [
                    ‘#006ebe’
                    ],
                    subtitle: {
                        style: {
                            display: ‘none’
                        }
                    },
                    xAxis: {
                        lineWidth: 1,
                        lineColor: ‘#dfe7ef’,
                        gridLineWidth: 0,
                        lineColor: ‘#000000’,
                        startOnTick: true,
                        tickPixelInterval: 110,
                        type: ‘datetime’,
                        labels: {
                            rotation: -45,
                            y: 40,
                            style: {
                                color: ‘#000000’,
                                fontSize: ‘8px’,
                                fontWeight: ‘normal’

加上简单的内容

XHTML

<a-box position=’0 0.5 0′ material=’opacity: 0.5;’></a-box>

1
<a-box position=’0 0.5 0′ material=’opacity: 0.5;’></a-box>

即使大家创设了 3d
场景,大家得以初阶向里面添加对象。在那行代码中,大家添加了一个简便的盒子。然后咱们修改了它的材质,让它变得透明。大家也变更了它的地方,所以它出现在
AR 标识(AR marker)的顶端。

(摄像截图)

亚洲必赢官网 30

亚洲必赢官网 31

jQuery:那里是怎完毕?原代码没看懂

您那段代码中jquery只是拍卖了,<span>的click事件。
当click暴发时,只突显大标题,并且点击了哪些大标题,就会呈现其下相应的小标题。

关于为何一进入页面就显示大标题,可能跟你的css有关联呢。
 

jQuery中的DOM操作,jquerydom DOM(Document
Object
Model)文档对象模型,每张网页都能用DOM表示出来,每一份DOM都能看做一颗DOM树。
jQuery继承…

                            }
                        },
                        tickColor: ‘#000000’,
                        tickLength: 5,
                        tickWidth: 1,
                        dateTimeLabelFormats: {
                            day: ‘%Y-%m-%d’,
                            week: ‘%Y-%m-%d’,
                            month: ‘%Y-%m-%d’,
                            year: ‘%Y-%m-%d’
                        },
                        title: {
                            style:
                      {
                          display: ‘none’
                      }
                        }

增加 AR 摄像头

XHTML

<a-marker-camera preset=’hiro’></a-marker-camera>

1
<a-marker-camera preset=’hiro’></a-marker-camera>

在最终一步,大家增添一个视频头。大家预设一个 ‘hiro’(来自Hiro
marker)最终,大家让它像您手机同样移动。是还是不是很简短?

恭贺!你完了了。你仅用了 10 行 HTML
代码达成了增强现实,手机上也能运作高效,而且免费。

可以看一下自身做的视频教程(搬运自youtube,字幕为 youtube
自动识别内嵌字幕,有少量识别误差,不影响来看):

(一些截图)

亚洲必赢官网 32

打赏帮助我翻译越来越多好小说,谢谢!

打赏译者

首先,你必要引入a-frame,一款MozillaVR引领的支付 VR 体验的利器。A-frame
包蕴了 three.js。然后您只须求为 a-frame 引入 AR.js。AR.js能让 AR 中的 3d
显示在您的无绳电话机上高速运行,哪怕是 2、3 年前的旧手机。

                    },
              yAxis: {
                        allowDecimals: true,
                        startOnTick: true,
                        endOnTick: true,
                        lineWidth: 1,
                        gridLineWidth:0,
                        gridLineColor: ‘#d3d3d3’,
                        lineColor: ‘#000000’,
                        tickColor: ‘#000000’,
                        tickLength: 5,
                        tickWidth: 1,
                        title: {
                            text: ‘重量(kg)’,
                            style: {
                                color: ‘#02528b’,
                                fontSize: ’12px’,
                                fontWeight: ‘normal’

打赏匡助我翻译更多好小说,谢谢!

任选一种支付办法

亚洲必赢官网 33
亚洲必赢官网 34

2 赞 8 收藏 1
评论

定义 Body

                            }
                        },
                        labels: {
                            style: {
                                color: ‘#亚洲必赢官网 ,000000′,
                                fontSize: ’10px’,
                                fontWeight: ‘normal’
                            }
                        }
                    },
                    legend: {
                        layout: ‘horizontal’,
                        backgroundColor: ‘#ffffff’,
                        align: ‘right’,
                        verticalAlign: ‘top’,
                        x: 0,
                        y: -10,
                        floating: true,
                        shadow: false,
                        borderWidth: 0
                    },
                    tooltip: {
                        shared: true,
                        crosshairs: true
                    },
                    plotOptions: {
                        spline: {
                            shadow: false,
                            animation: false,
                            lineWidth: 1
                        },
                        series: {
                            color: ‘#000000’,
                            marker: {
                                enabled: true,
                                fillColor: ‘#006ebe’,
                                lineWidth: 1,
                                lineColor: ‘#006ebe’,
                                radius: 3
                            }
                        }
                    },
                    series: [{
                        name: ‘重量’,
                        data: [[Date.UTC(2012, 9, 8, 10, 22, 00),
88.8], [Date.UTC(2012, 9, 10, 10, 22, 00), 87.9], [Date.UTC(2012, 9,
13, 10, 00, 00), 87.4], [Date.UTC(2012, 9, 14, 12, 05), 87.2],
[Date.UTC(2012, 9, 16, 10, 00, 00), 87.2], [Date.UTC(2012, 9, 18, 10,
00, 00), 86.8], [Date.UTC(2012, 9, 22, 10, 00, 00), 86.5],
[Date.UTC(2012, 9, 25, 10, 00, 00), 86.5], [Date.UTC(2012, 9, 30, 10,
00, 00), 86.4]],
                        dataLabels: {
                            enabled: true
                        }

有关小编:一杯哈希不加盐

亚洲必赢官网 35

结束学业于阿伯丁高校软件工程规范,身为
Java 程序猿也常用 JavaScript 做点好玩的东西
。为了兴趣而写代码,做要好喜欢做的事。Keep Coding … Stay Cool …
(单身,欢迎纷扰)
个人主页 ·
我的稿子 ·
30 ·
   

亚洲必赢官网 36

亚洲必赢官网 37

                    }]

这一步,国际惯例。就好像您在颇具 HTML 页面中做的相同,定义 body。

                });
            });

创建 3d 场景。

        });
    </script>
</head>
<body>
    <script src=”Lib/Highcharts-2.2.5/js/highcharts.js”
type=”text/javascript”></script>
    <!– <script
src=”../../js/modules/exporting.js”></script>–>
    <div id=”bg” style=”margin: 0; padding: 0;”>
        <div style=”width: 736px; margin: 0 auto; height: 27px;
line-height: 27px; font-family: Microsoft YaHei;
            font-size: 14px”>
            <span style=”color:
#006ebd;”>体重曲线图:</span><span style=”font-size: 14px;
color: #000000;”>单位[kg]</span></div>
        <div id=”splineContainer” style=”width: 736px; height: 310px;
margin: 0 auto; padding-bottom: 10px;
            border-bottom: 1px dashed #9b9b9b;”>
        </div>
    </div>
</body>
</html>

亚洲必赢官网 38

 

接下来,大家就要创造大家的 a-farme 场景。大家本来也急需参预 ARToolkit
组件。ARToolkit是一个开源库,大家经过它来促成视频头定位。

运作效果:

累加简单的始末

 

亚洲必赢官网 39

 亚洲必赢官网 40

假若我们创造了 3d
场景,大家得以早先向里面添加对象。在那行代码中,我们添加了一个简易的盒子。然后大家修改了它的材质,让它变得透明。大家也变更了它的岗位,所以它出现在
AR 标识(AR marker)的上方。

 

增加 AR 摄像头

代码:
[html] !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html
head title重量曲线图/title script typ…

亚洲必赢官网 41

在最终一步,大家扩充一个视频头。大家预设一个
‘hiro’最终,我们让它像您手机一样移动。是还是不是很粗略?

恭贺!你做到了。你仅用了 10
html代码已毕了增强现实,手机上也能运行高效,而且免费。

网站地图xml地图