数据库连接池
package com.Day6_13;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class DruidDemo {
public static void main(String[] args) {
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = Druid.getConnection();
String sql = "insert into crouse values(?,?,?,?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,"102");
pstmt.setString(2,"C++");
pstmt.setString(3,"C语言");
pstmt.setInt(4,5);
int count = pstmt.executeUpdate();
System.out.println(count);
} catch (SQLException e) {
e.printStackTrace();
}finally {
Druid.close(pstmt,conn);
}
}
}
Window:窗口对象
var openBtn = document.getElementById("openBtn");
var win;
openBtn.onclick = function () {
win = open("https://www.baidu.com");
}
var closeBtn = document.getElementById("closeBtn");
closeBtn.onclick = function () {
win.close();
}
setTimeout("alert('boom~~')",3000);一次性
*/
function fun(){
alert('boom~~');
}
setInterval(fun,3000); //循环定时器
var newp = document.getElementById(newp);
newp.onclick = function () {
location.reload();
}
var bzhan = document.getElementById(pass);
bzhan.onclick = function () {
location.href = "https://www.baidu.com";
}
自动跳转页面
<p>
<span id="time">5</span>秒之后,自动跳转到首页...
</p>
<script>
var second = 5;
function showtime() {
second--;
var time = document.getElementById("time");
time.innerHTML = second + "";
if (second <= 0){
location.href = "https://www.baidu.com";
}
}
setInterval(showtime,1000);
</script>