I have just done the code for submit the form using JavaScript.
It works in all browsers except in Internet Explorer 6.
I have pasted my HTML form and JavaScript code below.
Can you please find what's the problem with it?
JavaScript:
    <s开发者_如何学Pythoncript type="text/javascript" language="javascript">
    function dodelete(image_id)
    {
        if (confirm("Are you sure want to delete this image?"))
        {
            document.getElementById('image_id').value=image_id;
            document.del_form.submit();
        }
    }
    </script>
HTML Code:
    <form name="del_form" id="del_form" method="post">
        <input type="hidden" name="do" id="do" value="delete" />
        <input type="hidden" name="image_id" id="image_id" />
    </form>
Function Call Code:::
<p class="video">
  <a href="javascript:void(0)" onclick="dodelete('<?php echo $row['image_id']?>')">                                 
    <img src="<?php echo $cfg->admin_image_path; ?>/delete_icon1.gif" border="0" alt="Delete"/>
   </a>
</p>
What is returned by:
document.getElementById('image_id')
It returns one INPUT element of collection of elements?
Try to replace:
document.getElementById('image_id').value=image_id;
with:
document.del_form.image_id.value=image_id; 
OnSubmit call for javascript would help.
<form name="del_form" id="del_form" onsubmit="dodelete(value);" >
    <input type="hidden" name="do" id="do" value="delete" />
    <input type="hidden" name="image_id" id="image_id" />
</form>
There are two things I'd like to try, I'm not sure why or when this doesn't work it seems random, first try to set a timeout for the submit :
document.doSubmit = function() {
    document.del_form.submit();
}
setTimeout("document.doSubmit();", 100);
Sometimes, just return something after the click works : 
<input type="hidden" name="image_id" id="image_id" onclick="submitFormFunction(); return false;” />
What happens if you replace:
    document.del_form.submit();
with:
document.getElementById('del_form').submit()
Try to move method='POST' to the beginning of form element definition. 
I mean -- method attribute should be the first attribute of form element.
If I remember well, this fixed some problems with submitting forms on IE6.
I have edited your code a little bit.
<script type="text/javascript" language="javascript"> 
    function dodelete(image_id) 
    { 
        if (confirm("Are you sure want to delete this image?")) 
        { 
            document.getElementById('image_id').value=image_id; 
            document.del_form.submit(); 
        } 
 return false;
    } 
</script> 
and the HTML with some test Image ID and it works in IE6
<form name="del_form" id="del_form" method="post" onSubmit="return(dodelete('2'));"> 
        <input name="do" id="do" value="delete" /> 
        <input name="image_id" id="image_id"  /> 
<input type="submit" value="Submit">
</form> 
Let's try again :).
What happen after replacing:
onclick="dodelete('<?php echo $row['image_id']?>')">
with:
onclick="dodelete('<?php echo $row['image_id']?>'); return false;">
What exactly doesn't work with your code? Throw JS error, there is no server request, values in request are empty?
And (maybe the most important question) -- where is action attribute for your del_form form?
replace
<a href="javascript:void(0)"
with
<a href="#"
IE have problem with that for the dom that fires the JS submit.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论