jinglingniit 2007-9-13 12:02
使用JQuery得到EWEB的值!!!!急!!!!!!
在点击button之后,alert content的值什么东西都没有,
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
("#submit").click(function(){
var addtype=$("#add_type").val();
var title=$("#title").val();
//var content=$("#news_content").text();
var content=$("#news_content").val();
alert(addtype);
alert(title);
alert(content);
});
});
</script>
<div style="padding:20px;text-align:center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12%" height="25"><img src="images/ico_baike.gif" width="24" height="24" align="absmiddle" /> <span style="font-size: 14px">\u53d1\u5e03\u8d44\u8baf</span></td>
<td width="11%" height="25"> </td>
<td width="71%" height="25"> </td>
<td width="6%" height="25"> </td>
</tr>
<tr>
<td height="25"> </td>
<td height="25" valign="top"><div align="right">
\u9009\u62e9\u65b0\u95fb\u7c7b\u578b\uff1a
</div>
</td>
<td height="25" valign="top">
<div align="left">
<select name="add_type" id="add_type">
<option value="news" >\u6dfb\u52a0\u65b0\u95fb</option>
<option value="charcter" >\u4e3b\u529b\u6587\u5b57</option>
</select>
</div>
</td>
<td height="25">
</td>
</tr>
<tr>
<td height="25"> </td>
<td height="25" valign="top"><div align="right">\u8d44\u8baf\u6807\u9898\uff1a</div></td>
<td height="25" valign="top"><div align="left">
<input name="title" id="title" type="text" id="dt2" style="width:250px;" maxlength="50"/>
</div></td>
<td height="25"> </td>
</tr>
<tr>
<td height="25"> </td>
<td height="25" valign="top"><div align="right" >\u8d44\u8baf\u5185\u5bb9\uff1a</div></td>
<td height="25" valign="top"><label>
<div align="left" style="background:yellow">
<input type="hidden" name="news_content" id="news_content">
<IFRAME ID="eWebEditor1" SRC="../eWeb/ewebeditor.htm?id=news_content&style=full" FRAMEBORDER="0" SCROLLING="no" WIDTH="550" HEIGHT="400"></IFRAME>
</div>
</label></td>
<td height="25"> </td>
</tr>
<tr>
<td height="25"> </td>
<td height="25"> </td>
<td height="25"> </td>
<td height="25"> </td>
</tr>
<tr>
<td height="25"> </td>
<td height="25"> </td>
<td height="25"><label>
<div align="left">
<input type="button" name="submit" id="submit" value="\u53d1\u5e03" />
<input type="button" name="reset" id="reset" value="\u53d6\u6d88" />
</div>
</label></td>
<td height="25"> </td>
</tr>
<tr>
<td height="25"> </td>
<td height="25"> </td>
<td height="25"> </td>
<td height="25"> </td>
</tr>
<tr>
<td height="25"> </td>
<td height="25"> </td>
<td height="25"> </td>
<td height="25"> </td>
</tr>
</table>
</div>
[[i] 本帖最后由 jinglingniit 于 2007-9-13 12:07 编辑 [/i]]
chris 2007-9-13 12:55
首先你在在web服务器上调试,也就是地址是以http://开头的,再就是不能跨域使用
在var content=$("#news_content").val();这一句上面加上:[code]$("#news_content").val(window.eWebEditor1.document.body.innerHTML);[/code]然后把iframe加上name[code]<IFRAME ID="eWebEditor1" name="eWebEditor1" SRC="../eWeb/ewebeditor.htm?id=news_content&style=full" FRAMEBORDER="0" SCROLLING="no" wIDTH="550" HEIGHT="400"></IFRAME>[/code]就可以了
jinglingniit 2007-9-13 13:27
怎么得到的是一个object呢
jinglingniit 2007-9-13 14:13
问题解决了
实际上在用EWEB的时候,得到他的值,并不是很难的,只是我对他的方法不怎么了解而已
他有一个方法叫getHTML(),就可以的到了
可以参考这个[url]http://www.ewebeditor.net/example.asp[/url]