Steven Sugiarto Wijaya Steven Sugiarto Wijaya - 5 days ago 6
HTML Question

Attribute not work more than 2 script

this is my code:

<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>


when submit my form, form hidden and div with id load is showing. but the third id not work. id name bodi used to show menu in my page.

if i change line between id load and bodi, it give the opposite.

any suggest?

Answer

In your code bodi is class not an id. Try following code

<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>
Comments