新增全局属性

来源:互联网 发布:dota2比赛数据 编辑:程序博客网 时间:2024/06/18 15:31

contenteditable


代码:

<!doctype html><html><head><meta charset="utf-8"><title>contenteditable的用法</title></head><body><h3 contenteditable="true">1111111111111111</h3><!--ol表示有序列表,li为项目符号--><ol contenteditable="true"><li>列表1</li><li>列表2</li><li>列表3</li><li>列表4</li></ol></body></html>

结果:

                                                      未编辑时的状态(左)                                                                                         编辑时的状态(右)

                                                                   

spellcheck


代码:

<!doctype html><html><head><meta charset="utf-8"><title>spellcheck的用法</title></head><body><p>下面是一个允许拼写检查的框</p><!--input表示输入框--><input type="text" spellcheck="true"><p></p><textarea rows="10" cols="30" spellcheck="true">这是一个允许拼写检查的文本框</textarea><p></p><p contenteditable="true" spellcheck="true">这是一个可以编辑并且可以进行拼写检查的文本</p></body></html>

结果:


tabIndex


代码:

<!doctype html><html><head><meta charset="utf-8"><title>tabindex的用法</title><!--使用javascript代码写一个showTabIndex函数,这个函数主要是获取每个按钮的tabIndex属性,并且在页面上显示输出切换的顺序--><script type="text/javascript">function showTabIndex(){var bt1=document.getElementById('bt1').tabIndex;var bt2=document.getElementById('bt2').tabIndex;var bt3=document.getElementById('bt3').tabIndex;    document.write("Tab切换按钮1的顺序:"+bt1);document.write("<br/>");document.write("Tab切换按钮2的顺序:"+bt2);document.write("<br/>");document.write("Tab切换按钮3的顺序:"+bt3);}</script></head><body><!--br为换行 p为增加一行 id为按钮的名字 tabindex表示在键盘上按“Tab”键,该是哪个按钮进行切换,即按钮的切换顺序--><button id="bt1" tabindex="2">按钮1</button><br/><p></p><button id="bt2" tabindex="1">按钮2</button><br/><p></p><button id="bt3" tabindex="3">按钮3</button><br/><p></p><!--通过onclick调用函数--><input type="button" onClick="showTabIndex()" value="显示切换顺序"/></body></html>

结果:

                                                                                  刚开始的页面                                                                            按“显示切换顺序”按钮后 的结果