function closeMusic() { var music = window.parent.document.getElementById("music"); music.style.display = "none"; var content = window.top.document.getElementById("content"); content.src = "../../bands/rrr/rrr.php"; } <form class="delButton" id="delAlbButton" method="post" action="../../../../scripts/php/deletealbum.php"> <input type="hidden" value="'.$BN.'" id="BNforDel" name="BN"/> <input type="hidden" value="'.$AN.'" id="ANforDel" name="AN"/> <input type="submit" onClick="closeMusic();" value="DEL"> </form> 

click to call the script to delete this page.

and js f-i, which suddenly iframe loads the page

returns Failed to a load resource: the server responded with a http: //localhost/bands/rrr/rrr.php status of 404 (Not Found)

the path is exactly correct

although the one that produces and the desired various

http: //localhost/NetFM/bands/rrr/rrr.php

Help please, what's the problem?

    1 answer 1

    Instead of onClick="closeMusic();" use onsubmit .

     var form = document.getElementById('delAlbButton'); form.onsubmit = function(){ closeMusic(); } 

    use the absolute path for the URL.

     content.src = "http://localhost/NetFM/bands/rrr/rrr.php";