第一個<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
</head> <body>
<script type="text/javascript">
function c(){
if(confirm('是否要刷新')==true){
window.location = 'index.php';
}
}
</script> <input type="button" name="b1" value="點我刷新" onclick="c()">
</body>
</html>
<html>
<head>
<title> New Document </title>
</head> <body>
<script type="text/javascript">
function c(){
if(confirm('是否要刷新')==true){
window.location = 'index.php';
}
}
</script> <input type="button" name="b1" value="點我刷新" onclick="c()">
</body>
</html>
2:table外层用个div包含设置宽度
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<style type="text/css">
.tb{
width:100%;
}
.tb td{
width:20%;
text-align:center;
border:1px solid #000000;
border-collapse:collapse;
}
</style>
</head> <body>
<table class="tb">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</table>
</body>
</html>
刷新后的页面一部分与之前发布消息的页面的一部分交叠了,不知道怎么回事;使用location.reload( ); 点击消息提示窗口的“确定”之后,又会弹出消息提示窗口……根本停不下来……
有截圖嗎?停不下來是因為你沒有停。你需要加一個條件,判斷刷新後不再執行那段javascript.
你说的刷新后为什么不是同一页面了?
就是又多出来一个页面。
其实只想要当前页面刷新~~~~location.href='?r=' + Math.random();这样,试下。
//试试这两个中的一个
window.history.back();
window.history.go(-1);