js如何取Iframe中textarea的内容? 我用document.form1.textareaname.value取Iframe中textarea的值 第一次总是取不到,但第二次又取的到。 这怎么回事,应该怎么弄? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <textarea id="content" name="content" style="display:none"></textarea><IFRAME ID="eWebEditor1" src="/eWebEditor/eWebEditor.jsp?id=content&style=standard&ofilename=images_with_orgname&savefilename=images_without_path&savepathfilename=images_with_path&savedPhysicalPath=<=savedPhysicalPath>&webPath=<%=webPath%>"frameborder="0" scrolling="no" width="650" height="350"></IFRAME>这是jsp代码在一个button的onclick事件中调用下面js代码<script>var a = document.form1.content.value;alert(a);</script>第一次去取不到值,刷新页面后第二次又取的到。 可以用<script> var a =document.getElementById("content").value;alert(a); </script> var a= eWebEditor1.getHTML(); //eWebEditor1是Iframe的ID,getHTML()是内置方法。 for(var i = 0; i < a.length; i++){ a= a.replace("<p>",""); //去掉空格和换行 a= a.replace("</p>",""); a= a.replace("<P>",""); a= a.replace("</P>",""); a= a.replace(" ",""); } a=a.replace(/^\s+|\s+$/g,""); if(a==""){ alert("<%=getString("content"); }应该是这样我解决了,楼上的也不行,有漏洞,第一次取不到。 不能传递数据到下一个网页 小弟求各位解决下 js的菜鸟问题,大侠进 新手求教,js判断输入为空,代码不知错在哪里,谢谢 如何在静态页面中输出外部文件? 招聘熟悉HTML,DHTML,JavaScript等客户端脚本的人才! 点击见大图 请教一个文件的下载地址 ------ select框的问题(不好意思没有分了)----- 一个java在获取网页标题是的问题!请高手赐教!在线等! 怎么在输入框显示提示 eclipse安装问题 简单而精深的function 问题?大大帮忙吖
<IFRAME ID="eWebEditor1" src="/eWebEditor/eWebEditor.jsp?id=content&style=standard&ofilename=images_with_orgname&savefilename=images_without_path&savepathfilename=images_with_path&savedPhysicalPath=<=savedPhysicalPath>&webPath=<%=webPath%>"frameborder="0" scrolling="no" width="650" height="350"></IFRAME>
这是jsp代码
在一个button的onclick事件中调用下面js代码
<script>
var a = document.form1.content.value;
alert(a);
</script>第一次去取不到值,刷新页面后第二次又取的到。
<script>
var a =document.getElementById("content").value;
alert(a);
</script>
for(var i = 0; i < a.length; i++){
a= a.replace("<p>",""); //去掉空格和换行
a= a.replace("</p>","");
a= a.replace("<P>","");
a= a.replace("</P>","");
a= a.replace(" ","");
}
a=a.replace(/^\s+|\s+$/g,"");
if(a==""){
alert("<%=getString("content");
}应该是这样
我解决了,楼上的也不行,有漏洞,第一次取不到。