这是我的代码:
<script>
document.getElementById("formPemasaranSertifikat").style.display="none";
document.getElementById("load").setAttribute("style","");
document.getElementById("bodi").style.display="none";
<script>
<div class="bodi">
<?php
include "menuPemasaranSertifikat.php";
?>
</div>
<div id="load" style="display:none;">
<img src="src/loading.gif" alt="proses upload" />
</div>
<form action="hasilUploadSertifikat.php" method="POST" id="formPemasaranSertifikat" enctype="multipart/form-data" onsubmit="return validateForm()"></form>
当提交我的表单时,表单隐藏并显示带有id load的div。但第三个ID不起作用。 id name bodi用于在我的页面中显示菜单。
如果我改变id load和bodi之间的界限,则会给出相反的结果。
有什么建议吗?
答案 0 :(得分:1)
在您的代码bodi
中,class不是id。请尝试以下代码
<script>
document.getElementById("formPemasaranSertifikat").style.display="none";
document.getElementById("load").setAttribute("style","");
document.getElementById("bodi").style.display="none";
<script>
<div id="bodi">
<?php
include "menuPemasaranSertifikat.php";
?>
</div>
<div id="load" style="display:none;">
<img src="src/loading.gif" alt="proses upload" />
</div>
<form action="hasilUploadSertifikat.php" method="POST" id="formPemasaranSertifikat" enctype="multipart/form-data" onsubmit="return validateForm()"></form>
答案 1 :(得分:0)
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function test(){
document.getElementById("formPemasaranSertifikat").style.display="none";
document.getElementById("load").style.display = "block";
document.getElementById("bodi").style.display="none";
}
</script>
<style type="text/css">
.hidden{
display:none;
}
</style>
</head>
<body>
<div id="bodi">
<?php
include "menuPemasaranSertifikat.php";
?>
</div>
<div class="hidden" id="load">
<img src="src/loading.gif" alt="proses upload" />
</div>
<form action="hasilUploadSertifikat.php" method="POST" id="formPemasaranSertifikat" enctype="multipart/form-data" >
<input type="button" value="submit" onclick="test()">
</form>
</body>
</html>