下面是代碼:JQuery的代表在Internet Explorer 8中不能正常工作
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TITLE</title>
<link type="text/css" href="jsutil/menubar/menu.css" rel="stylesheet"/>
<link type="text/css" media="screen" href="jsutil/tablesorter/css/style.css" rel="stylesheet"/>
<script type="text/javascript" src="js/jquery-1.7.min.js"></script>
<script type="text/javascript" src="jsutil/menubar/menu.js"></script>
<script type="text/javascript" src="jsutil/tablesorter/js/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="jsutil/tablesorter/js/jquery.tablesorter.pager.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#tabe").tablesorter();
$("#tabe").width(600);
$("#tabe").delegate("td", "click", function()
{
var idCampanha = $(this).parent().find("td:first").html();
//Seleciona campanha
alert("clicked in: "+idCampanha);
event.preventDefault();
});
$("#buscacamp").delegate("#bbcamp", "click", function()
{
alert("doing post");
var jqxhr = $.post("php/slistar_campanhas.php",
{nome : $("#bcamp").val() },
function(data)
{
$("#tabe > tbody").empty();
for(var i=0;i<data.length;i++)
{
var obj = data[i];
$("#tabe > tbody:last").append('<tr><td>'+obj.idcampanha+'</td><td>'+obj.nome+'</td></tr>');
}
event.preventDefault();
},
"json"
);
alert("post done");
jqxhr.error(function(){ alert("Erro") });
event.preventDefault();
});
});
</script>
</head>
<body bgcolor="#3B3131">
<div id="menu">
...JUST A WORKING MENU HERE
</div>
<div id="corpo" align="center">
<h1 align="center" style="color:#F8F8F8">Selecionar Campanha</h1>
<form id="buscacamp">
<label style="color:#F8F8F8" for="bcamp">Nome da campanha</label>
<input align="middle" size="35" type="text" name="bcamp" id="bcamp"/>
<br/>
<input type="submit" id="bbcamp" value="OK"/>
</form>
<table id="tabe" class="tablesorter" cellspacing="1">
<thead>
<tr>
<th>Código da Campanha</th>
<th>Nome da Campanha</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Código da Campanha</th>
<th>Nome da Campanha</th>
</tr>
</tfoot>
<tbody>
</tbody>
</table>
<h1 id="titulo" class="cor" style="color:#F8F8F8">Nova Solicitação</h1>
<form id="novasol">
<label for="campanha" style="color:#F8F8F8">Campanha</label>
<input size="20" type="text" name="campanha" id="campanha" readonly/>
<br/><br/>
<label for="titulo" style="color:#F8F8F8">Título</label>
<input size="35" type="text" name="titulo" id="titulo"/>
<br/><br/>
<label for="descricao" style="color:#F8F8F8">Descrição</label>
<textarea rows="17" cols="55" id="descricao"></textarea>
<br/>
<label for="naudios" style="color:#F8F8F8">Número de áudios</label>
<input size="10" type="text" name="naudios" id="naudios"/>
<input type="submit" id="enviar" value="Enviar"/>
</form>
</div>
</body>
</html>
時#bbcamp點擊Chrome的輸出: 1-警報後做
2-警報後做
3-將行添加到表中,當我點擊它們時會顯示另一個警報
IE 8輸出被點擊時#bbcamp: 1-警報做交
2-添加行表
3-警報後完成
4-擦除行和離開我用空表
我tryed使用click事件和它沒有工作,要麼... 我使用jQuery 1.7分鐘
任何想法?
您可能會考慮在警告停止執行時刪除警報,並且可能會產生副作用。改用'console.log'。 – Esailija