异常一| 创建人 | | | | | | | | | | | [mw_shl_code=html,true]tds.onmouseout =fun2;
function fun2() {
setTimeout(function (){
this.src = "image/off.gif";
},2000);
}[/mw_shl_code]
| | | 问题解决方法: [mw_shl_code=html,true]function fun2() {
var tamp=this;
setTimeout(function (){
tamp.src = "image/off.gif";
},2000);
[/mw_shl_code]
} |
异常二| 创建人 | | | | | | | | | | | [mw_shl_code=java,true]BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream("S1/src/a.txt"));
bos.close();
bos.write(1);[/mw_shl_code] | | | | 异常三| 创建人 | | | | | | | | | | | <script src="js/bootstrap.min.js"></script> <script src="js/jquery-3.2.1.min.js"></script> | | 问题分析: jQuery导包必须写在 JavaScript导包之前 | 问题解决方法: <script src="js/jquery-3.2.1.min.js"></script> <script src="js/bootstrap.min.js"></script> | 异常四| 创建人 | | | | | | | | | | | [mw_shl_code=java,true]public class Test {
private JdbcTemplate template=new JdbcTemplate(new ComboPooledDataSource());
@Test
public void test1(){
String sql="update emp set salary =10000 where id=?";
int count = template.update(sql,1001);
System.out.println(count);
}[/mw_shl_code] } | | 问题分析: @Test引入路径出问题,文件名与@Test重名 | | 异常五| 创建人 | | | | | | | | | | | [mw_shl_code=java,true]public class Demo1 {
public static void main(String[] args) throws Exception {
//2.注册驱动
Class.forName("com.mysql.jdbc.Driver");
//3.获取数据库连接对象
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db3", "root", "root");
//4.定义sql语句
String sql="CREATE TABLE asd (\n" +
" id INT PRIMARY KEY, -- 员工id\n" +
" ename VARCHAR(50), -- 员工姓名\n" +
" job_id INT, -- 职务id\n" +
" mgr INT , -- 上级领导\n" +
" joindate DATE, -- 入职日期\n" +
" salary DECIMAL(7,2), -- 工资\n" +
" bonus DECIMAL(7,2), -- 奖金\n" +
" dept_id INT -- 所在部门编号\n" +
");";
int i = conn.createStatement().executeUpdate(sql);
System.out.println(i);
conn.close();
}
}
[/mw_shl_code] | | 问题分析: int i = conn.createStatement().executeUpdate(sql);
链式编程不一定都是好处,此处无法关闭stmt对象 | 问题解决方法: [mw_shl_code=java,true]//5.获取执行sql的对象 Statement
Statement stmt = conn.createStatement();
//6.执行sql
int count = stmt.executeUpdate(sql);
stmt.close();[/mw_shl_code] | 异常六| 创建人 | | | | | | | | | | | [mw_shl_code=html,true]<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>定时跳转</title>
<style>
p{
text-align: center;
}
span{
color: red;
}
</style>
</head>
<body>
<p>
<span id="time">5</span>秒之后进行跳转...
</p>
<script>
var second=5;
var time=document.getElementById("time");
function fun1() {
second--;
if(second<0){
location.href="";
}
time.innerHTML=second;
}
setInterval(fun1(),1000);
</script>
</body>
</html>[/mw_shl_code] | | | 问题解决方法: setInterval(fun1(),1000);更改为setInterval(fun1,1000); |
|
|