隐藏的iframe中,form的submit总是失败 submit(); 是不是后边中文分号的问题? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 一个是小梅说的分号还有frames['sub_content_prvw'].document.getElementById('sub_prvw').action = 'wap_page.php?op=editor_save_prvw&id'+id; 这句改下frames['sub_content_prvw'].document.sub_prvw.action function c_editor_save_prvw()调用了吗? to zhaoxiaoyang(梅雪香@深圳):中文分号“;”是帖帖子时的笔误,我的文件中是正确的英文分号,但是submit()还是失败的。to hbhbhbhbhb1021(天外水火(我要多努力)):改为frame_name.document.form_name.action也不行。to chouchy(城市刀客):确定c_editor_save_prvw()是调用了。 参考PAGE A: <script> var iframeObj = document.getElementById("workFrame"); function changeDiv(){ iframeObj.src="url page b"; } function changeFrom(){ document.formName.target="workFrame"; document.formName.submit(); } </script> <input type="button" name="" value="Change Div" onclick="changeDiv();"> <input type="button" name="" value="Form div" onclick="changeFrom();"><DIV id="divId"> Main page Content </DIV> <Form id="formId" name="formName" action="url page b"></Form> <iframe id="workFrame" width="0" height="0" src="">PAGE B ,iframe result page:<DIV id="divId"> iframe page result content . </DIV> <script> try{ var div = document.getElementById("divId"); var parent_div = parent.document.getElementById("divId"); if(div){ parent_div.innerHTML = div.innerHTML; } }catch(e){ alert(e); } </script> 谢谢cloudgamer(欢迎交流qq215754452)!但我觉得参考价值不大啊 搜索到这么一篇帖子:http://topic.csdn.net/t/20050326/02/3882421.html然后,我尝试修改我原来的c_editor_save_prvw()函数和sub_content_prvw.php文件分别如下:function c_editor_save_prvw(){ var str = "<{$action}>"; var id = str.substring(str.lastIndexOf('='), str.length); frames['sub_content_prvw'].document.getElementById('content_p').value = frames['x'].document.body.innerHTML.replace(/<!---->/g, ''); //有值,并且正确 alert(frames['sub_content_prvw'].document.getElementById('content_p').value); //for test frames['sub_content_prvw'].document.sub_prvw.action = 'wap_page.php?op=editor_save_prvw&id'+id; //地址是对的,浏览器中单独执行此地址没问题 alert(frames['sub_content_prvw'].document.sub_prvw.action); //for test frames['sub_content_prvw'].document.getElementById('sub_btn').click(); //参考搜索到的帖子,写了这一句,但仍失败}sub_content_prvw.php的新内容如下:<form id="sub_prvw" name="sub_prvw" method="post"><input type="hidden" id="content_p" /><input type="button" id="sub_btn" onclick="this.form.submit();" /><!--新加的--></form> 回复人:hbhbhbhbhb1021(天外水火(我要多努力)) ( 四星(高级)) 信誉:100 2007-6-7 20:46:43 得分:0? 一个是小梅说的分号还有frames['sub_content_prvw'].document.getElementById('sub_prvw').action = 'wap_page.php?op=editor_save_prvw&id'+id;这句改下frames['sub_content_prvw'].document.sub_prvw.action============他的代码很是很兼容的。 to yueliangdao0608((深圳PHPER.MSN:[email protected]):我已经尝试过这种形式了,但结果还是一样的。 我暂时用XMLHTTPRequest解决了,但用的是get方式(xmlhttpObj.open('get', url, true)),所以说存在传输大量数据的问题。开始我考虑用隐藏的frame中的form,也是为了避免这个问题。但现在…… 最终这样解决:function c_editor_save_prvw(){ if((xmlHttp = getXmlHttpObject()) == null) { alert('浏览器版本低,请更新或更换您的浏览器'); return; } var str = "<{$action}>"; var id = str.substring(str.lastIndexOf('='), str.length); var content_p = frames['x'].document.body.innerHTML.replace(/<!---->/g, ''); var url = 'wap_page.php' xmlHttp.open('post', url, true); xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlHttp.send('op=editor_save_prvw&content_p='+content_p+'&id'+id);}因为不用隐藏的frame了,sub_content_prvw.php文件也就不需要了 javascript不能调用 关于ExtJs中的datefield问题 求助:文字连接更随变色~ ●●●●●●●●●●●●●●●●●●●●●●●●●●●什么情况下this[key]和this.hasOwnProperty(key)的布尔值相反?????? 关于mce_的问题 请教js中的asc码 谢谢! JS获取页面doctype,有木有大侠知道,并且可以兼容IE,firefox的 请教高手2急切!!!!!!!!!!! 请问怎么判断客户端是否装Office 在线编辑超文本的控件哪里有啊? 问个很白的问题,js里面如何判断一个数是整数 如何将没有分隔符的字符串分割成数组,如ABD
还有
frames['sub_content_prvw'].document.getElementById('sub_prvw').action = 'wap_page.php?op=editor_save_prvw&id'+id;
这句改下
frames['sub_content_prvw'].document.sub_prvw.action
中文分号“;”是帖帖子时的笔误,我的文件中是正确的英文分号,但是submit()还是失败的。to hbhbhbhbhb1021(天外水火(我要多努力)):
改为frame_name.document.form_name.action也不行。to chouchy(城市刀客):
确定c_editor_save_prvw()是调用了。
<script>
var iframeObj = document.getElementById("workFrame");
function changeDiv(){
iframeObj.src="url page b";
}
function changeFrom(){
document.formName.target="workFrame";
document.formName.submit();
}
</script>
<input type="button" name="" value="Change Div" onclick="changeDiv();">
<input type="button" name="" value="Form div" onclick="changeFrom();"><DIV id="divId">
Main page Content
</DIV>
<Form id="formId" name="formName" action="url page b"></Form>
<iframe id="workFrame" width="0" height="0" src="">PAGE B ,iframe result page:<DIV id="divId">
iframe page result content .
</DIV>
<script>
try{
var div = document.getElementById("divId");
var parent_div = parent.document.getElementById("divId");
if(div){
parent_div.innerHTML = div.innerHTML;
}
}catch(e){
alert(e);
}
</script>
http://topic.csdn.net/t/20050326/02/3882421.html然后,我尝试修改我原来的c_editor_save_prvw()函数和sub_content_prvw.php文件分别如下:function c_editor_save_prvw()
{
var str = "<{$action}>";
var id = str.substring(str.lastIndexOf('='), str.length); frames['sub_content_prvw'].document.getElementById('content_p').value = frames['x'].document.body.innerHTML.replace(/<!---->/g, ''); //有值,并且正确
alert(frames['sub_content_prvw'].document.getElementById('content_p').value); //for test
frames['sub_content_prvw'].document.sub_prvw.action = 'wap_page.php?op=editor_save_prvw&id'+id; //地址是对的,浏览器中单独执行此地址没问题
alert(frames['sub_content_prvw'].document.sub_prvw.action); //for test
frames['sub_content_prvw'].document.getElementById('sub_btn').click(); //参考搜索到的帖子,写了这一句,但仍失败
}
sub_content_prvw.php的新内容如下:<form id="sub_prvw" name="sub_prvw" method="post">
<input type="hidden" id="content_p" />
<input type="button" id="sub_btn" onclick="this.form.submit();" /><!--新加的-->
</form>
? 一个是小梅说的分号
还有
frames['sub_content_prvw'].document.getElementById('sub_prvw').action = 'wap_page.php?op=editor_save_prvw&id'+id;
这句改下
frames['sub_content_prvw'].document.sub_prvw.action============
他的代码很是很兼容的。
开始我考虑用隐藏的frame中的form,也是为了避免这个问题。但现在……
{
if((xmlHttp = getXmlHttpObject()) == null) {
alert('浏览器版本低,请更新或更换您的浏览器');
return;
} var str = "<{$action}>";
var id = str.substring(str.lastIndexOf('='), str.length); var content_p = frames['x'].document.body.innerHTML.replace(/<!---->/g, ''); var url = 'wap_page.php'
xmlHttp.open('post', url, true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.send('op=editor_save_prvw&content_p='+content_p+'&id'+id);
}
因为不用隐藏的frame了,sub_content_prvw.php文件也就不需要了