开发者

error after submit a form

i have a php like this:

<?php
......
?>
<html>
<head></head>
<body>
<div id="content">
<form id="myform" name="myform">
<?php include_once("ronny.php"); ?>
.....
<input type="button" value="Save" id="Save" name="Save" onclick="if(check123()==true){document.myform.submit()}" />
</div>
</form>
...

Now, in this case after i click on save i have an error document.myform.submit is not a function in firebug and in IE the error is Object doesn't support this property or method. If i delete the <?php include_once("ronny.php"); ?> everything is ok.

ronny.php is like that:

<?php

if(......)){

?开发者_开发百科>
<div></div>
<div></div>
<SCRIPT LANGUAGE="JavaScript">
....
</SCRIPT>
<?php } ?>

If i put the include in the php at the top it's ok as well.

thank you!


document.myform.submit()

myform should be the name of form. What is check123()? Function?


If you want to use the document.myform notation, you'll have to add a name= attribute to the form tag:

<form name="myform">
...
</form>

or if you have to stick with the id version, then use this in Javascript:

document.getElementById('myform').submit();

Beyond that, what's in the ronny.php function? If taking it out makes the form work, then obviously something in ronny.php is messing with your HTML and/or Javascript and "breaking" things.


I would do :

<input type="button" value="Save" id="Save" name="Save" onclick="check123();this.form.submit();" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜