/* 2 功能:生成博客目录的JS工具 3 测试:IE8,火狐,google测试通过 6 */ 7 var BlogDirectory = { 8 /* 9 获取元素位置,距浏览器左边界的距离(left)和距浏览器上边界的距离(top) 10 */ 11 getElementPosition:function (ele) { 12 var topPosition = 0; 13 var leftPosition = 0; 14 while (ele){ 15 topPosition += ele.offsetTop; 16 leftPosition += ele.offsetLeft; 17 ele = ele.offsetParent; 18 } 19 return {top:topPosition, left:leftPosition}; 20 }, 21 22 /* 23 获取滚动条当前位置 24 */ 25 getScrollBarPosition:function () { 26 var scrollBarPosition = document.body.scrollTop || document.documentElement.scrollTop; 27 return scrollBarPosition; 28 }, 29 30 /* 31 移动滚动条,finalPos 为目的位置,internal 为移动速度 32 */ 33 moveScrollBar:function(finalpos, interval) { 34 35 //若不支持此方法,则退出 36 if(!window.scrollTo) { 37 return false; 38 } 39 40 //窗体滚动时,禁用鼠标滚轮 41 window.onmousewheel = function(){ 42 return false; 43 }; 44 45 //清除计时 46 if (document.body.movement) { 47 clearTimeout(document.body.movement); 48 } 49 50 var currentpos =BlogDirectory.getScrollBarPosition();//获取滚动条当前位置 51 52 var dist = 0; 53 if (currentpos == finalpos) {//到达预定位置,则解禁鼠标滚轮,并退出 54 window.onmousewheel = function(){ 55 return true; 56 } 57 return true; 58 } 59 if (currentpos < finalpos) {//未到达,则计算下一步所要移动的距离 60 dist = Math.ceil((finalpos - currentpos)/10); 61 currentpos += dist; 62 } 63 if (currentpos > finalpos) { 64 dist = Math.ceil((currentpos - finalpos)/10); 65 currentpos -= dist; 66 } 67 68 var scrTop = BlogDirectory.getScrollBarPosition();//获取滚动条当前位置 69 window.scrollTo(0, currentpos);//移动窗口 70 if(BlogDirectory.getScrollBarPosition() == scrTop)//若已到底部,则解禁鼠标滚轮,并退出 71 { 72 window.onmousewheel = function(){ 73 return true; 74 } 75 return true; 76 } 77 78 //进行下一步移动 79 var repeat = "BlogDirectory.moveScrollBar(" + finalpos + "," + interval + ")"; 80 document.body.movement = setTimeout(repeat, interval); 81 }, 82 83 htmlDecode:function (text){ 84 var temp = document.createElement("div"); 85 temp.innerHTML = text; 86 var output = temp.innerText || temp.textContent; 87 temp = null; 88 return output; 89 }, 90 91 /* 92 创建博客目录, 93 id表示包含博文正文的 div 容器的 id, 94 mt 和 st 分别表示主标题和次级标题的标签名称(如 H2、H3,大写或小写都可以!), 95 interval 表示移动的速度 96 */ 97 createBlogDirectory:function (id, mt, st, interval){ 98 //获取博文正文div容器 99 var elem = document.getElementById(id); 100 if(!elem) return false; 101 //获取div中所有元素结点 102 var nodes = elem.getElementsByTagName("*"); 103 //创建博客目录的div容器 104 var divSideBar = document.createElement('DIV'); 105 divSideBar.className = 'sideBar'; 106 divSideBar.setAttribute('id', 'sideBar'); 107 var divSideBarTab = document.createElement('DIV'); 108 divSideBarTab.setAttribute('id', 'sideBarTab'); 109 divSideBar.appendChild(divSideBarTab); 110 var h2 = document.createElement('H2'); 111 divSideBarTab.appendChild(h2); 112 var txt = document.createTextNode('目录导航'); 113 h2.appendChild(txt); 114 var divSideBarContents = document.createElement('DIV'); 115 divSideBarContents.style.display = 'none'; 116 divSideBarContents.setAttribute('id', 'sideBarContents'); 117 divSideBar.appendChild(divSideBarContents); 118 //创建自定义列表 119 var dlist = document.createElement("dl"); 120 divSideBarContents.appendChild(dlist); 121 var num = 0;//统计找到的mt和st 122 mt = mt.toUpperCase();//转化成大写 123 st = st.toUpperCase();//转化成大写 124 //遍历所有元素结点 125 for(var i=0; i
摘要: 数据库对象 用户模式:指数据库用户所创建和存储数据对象的统称。在访问其它用户模式的数据库对象时需加上用户模式。 如:scott.emp, scott.dept等。 数据库对象包括:表、视图、索引、序列、目录、同义词、数据库用户、存储过程、函数、触发器等。 同义词 同义词是现有数据库对象的一个别名。 阅读全文
posted @ 2019-09-19 14:38 我的人生 阅读(353) 评论(0) 推荐(0)
摘要: 子查询练习 复制create table empployee_demo( empno number(4) not null primary key, --员工编号,主键 ename varchar2(10) not null unique, --员工名,唯一键 job varchar2(9), -- 阅读全文
posted @ 2019-09-19 14:37 我的人生 阅读(463) 评论(0) 推荐(0)
摘要: 查询练习一 复制表创建 create table employee as select * from soctt.emp ; --记得授权 sysdba用户登录 grant select on scott.emp to $username$ --表结构 create table empployee_ 阅读全文
posted @ 2019-09-19 14:36 我的人生 阅读(294) 评论(0) 推荐(0)
摘要: 高级查询练习 复制/* 分组查询 */ create table empployee_demo( empno number(4) not null primary key, --员工编号,主键 ename varchar2(10) not null unique, --员工名,唯一键 job var 阅读全文
posted @ 2019-09-19 14:36 我的人生 阅读(315) 评论(0) 推荐(0)
摘要: SQL常用函数说明以及使用 以下补充以下常用的函数,更多的请看oracle函数API文档 to_char 复制to_char(8.58,'9.99') to_char(8.50,'9.00') to_char(8.50,'9.99') 复制create table employee( id numb 阅读全文
posted @ 2019-09-19 14:35 我的人生 阅读(333) 评论(0) 推荐(0)
摘要: 介绍 可用于获取关于 ResultSet 对象中列的类型和属性信息的对象,在持久框层框架(如:mybatis, hibernate)中被广泛的应用。 常用方法 int getColumnCount() 返回此 ResultSet 对象中的列数 String getColumnLabel(int co 阅读全文
posted @ 2019-09-19 14:34 我的人生 阅读(507) 评论(0) 推荐(0)
摘要: 预编译Statement优点 执行效率高 由于预编译语句使用占位符 ”?”,在执行SQL之前语句会被先发送到Oracle服务器进行语法检查和编译等工作,并将SQL语句加入到Oracle的语句缓冲池里,随后再对SQL语句中的占位符”?”设置定值。 那么也就说如果你要执行1000行插入的时候第一次先SQ 阅读全文
posted @ 2019-09-19 14:33 我的人生 阅读(374) 评论(0) 推荐(0)
摘要: SQL操作符 算术操作符:+加,-减,*乘,/除 比较操作符: <,>,=,!=,<>,<=,>= 常用的判断,<>和!=相同 between $lower_val$ and $hight_val$ between .. and.. 包括两端 复制--查询20<=age<=21的学生数据 selec 阅读全文
posted @ 2019-09-19 14:30 我的人生 阅读(291) 评论(0) 推荐(0)
摘要: JDBC使用 1. 导包 直接使用IDEA导入依赖包即可 新建一个lib,把jar包放在这里 2. 加载驱动 复制Class.forName("oracle.jdbc.driver.OracleDriver"); 3. 创建Connection对象 连接数据库,从而获得Connection对象 复制 阅读全文
posted @ 2019-09-19 14:30 我的人生 阅读(309) 评论(0) 推荐(0)
摘要: DML 数据管理语言 Data manage language insert, update, delete以及select语句,不过,有人也把select单独出来,作为DQL 数据查询语言 data query language insert,update和delete都需要执行commit才能将 阅读全文
posted @ 2019-09-19 14:29 我的人生 阅读(263) 评论(0) 推荐(0)