各位TX大家好。我想请教一下,为什么以下代码在ie6 和Chrome都运行得很好。但是在ie9上响应的时间却很久,百思不得其解,望指教!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body> <?
for($i=0;$i<100;$i++)
{
?>
<form id="form1" name="form1" method="post" action="">
<label for="f"></label>
<input type="text" name="f" value="dfdsfdsf" id="f" />
<input type="submit" name="d" id="d" value="提交" />
</form><?
}
?>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body> <?
for($i=0;$i<100;$i++)
{
?>
<form id="form1" name="form1" method="post" action="">
<label for="f"></label>
<input type="text" name="f" value="dfdsfdsf" id="f" />
<input type="submit" name="d" id="d" value="提交" />
</form><?
}
?>
</body>
</html>
我猜的
你有 100 个 id="form1" ,不出问题是人家宽容,出问题是因你违规
<?
for($i=0;$i<100;$i++)
{
?>
<form id="<?=$i?>" name="form1" method="post" action="">
<input type="text" name="f" value="dfdsfdsf" id="<?=$i?>" />
<input type="submit" name="d" id="<?=$i?>" value="提交" />
</form><?
}
代码如下,form1用变量$i代替,响应还是很久
<?
for($i=0;$i<100;$i++)
{
?>
<form id="<?=$i?>" name="<?=$i?>" method="post" action="">
<label for="f"></label>
<input type="text" name="f" value="dfdsfdsf" id="<?=$i?>" />
<input type="submit" name="d" id="<?=$i?>" value="提交" />
</form><?
}
?>