<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
window.onload = function hide_input_items()
{
var inputs=document.getElementsByTagName('input');
for(var i=0;i<inputs.length;i++)
{
if(inputs[i].type=='text')
{
inputs[i].disabled=1;
}
}
var updates = document.getElementById('update');
var cancels = document.getElementById('cancel');
for(var j=1;j<up;j++)
{
updates[j].style.visibility = "hidden";
cancels[j].style.visibility = "hidden";
}
}
</script>
</head>
<body>
<?php
$counter=0;
for($i=1;$i<10;$i++)
{
$counter++;
$name= "name".$counter;
$update="update".$counter;
$cancel="cancel".$counter;
$edit= "edit".$counter;
?>
<input type="text" name="name" id="name" id="<?php echo $name;?>" value="hi" />
<input type="button" name="edit" id="name" id="<?php echo $edit;?>" value="Edit" onclick="focuse('<?php //echo $id.",".$update.",".$cancel.",".$edit;?>')"/>
<input type="button" name="update" id="name" id="<?php echo $update;?>" value="Update" onclick="display('<?php //echo $cancel;?>');"/>
<input type="button" name="cancel" id="name" id="<?php echo $cancel;?>" value="Cancel" onclick="show()"/>
<br />
<?php
}?>
<input type="button" name="button" onclick="hide_all();" value="Hide all" />
</body>
</html>
我想在页面加载时隐藏更新和取消按钮,但是当我在页面加载功能中添加第二个循环时它不起作用然后上面的循环也是禁用的。以上是我的完整代码请给你一些建议,如果你有。感谢。