就是这样的一个文本框
网页留言板的代码看下面,我现在就想把DELPHI中EDIT控件的值写到网页的这个框中,大家帮帮忙吧,我折腾了好久了.成功后再加50分.
如果下面代码不明白,可以去http://www.yy365.com这个网站注册个用户,给好友留言就知道了.
<!--留言板--><a name=a_comment></a>
<div class="liuyan" >
      
<div class="liuyan_01" id="box1">
<div class="top">
<div class="top_left" id="commentTitle"> 马桂兰的留言板 </div><div class="top_left" id="replyTitle">  </div>
  
</div>
<div id="showtext" style="display:none">
<div class="mini_pl_text">   
<div style="margin-left:5px;" id="content_div" name="content_div" ></div>
comment_editor = new webEditor("comment_editor" , $("content_div") , 578, 100);
comment_editor.init("");
</script>
</div>
<div class="liuyan_end">
<input  class="btn" id="btnSaveWords" type="button" name="Submit" value="留言" onclick="commitWords();"/>
</div>
</div>
</div>
<div class="pro_e" style="display:none;" id="resultInfo"></div>
  
<!--留言列表-->
div class="liuyan_02" >
<div class="top_01">
<div class="top_left" style="float:left" > 
<span id="total"></span>&nbsp;&nbsp;
<a href="javascript:comment_editor.getFocus();">发布新留言</a> 

</div>
<div class="top_right" id="topbar" style="width:300px;"> </div>
</div>
<div id="wordswall">
</div>
<div class="top_02" >
<div class="top_left" > </div>
<div class="top_right" id="bottombar" style="width:400px;" > </div>
</div></div></div>
</div>
<script>
var request = null; 
var su = SigmaUtil;
window.onload = function(){
request = new SigmaRequest();
showGuestWords();

document.getElementById("showtext").style.display="";

} function showGuestWords(index,size){
request.open("post","guestwords!list.do",true);
if(index!=null){
request.setParameter("pageIndex",index);
}
if(size!=null){
request.setParameter("pageSize",size);
}else{
request.setParameter("pageSize",30);
}
request.setParameter("owner",316683);
request.onresult = function(){
var v = request.getValue(); if(v.exception == null){
showPage(v.page);
su.$("total").innerHTML ="共有"+ v.page.total+"条留言";
var p = v.page;

var s = createPageBar2(p.pageNumber,p.pageSize,p.pageIndex,'javascript:showGuestWords',5);
su.$("topbar").innerHTML = s;
su.$('bottombar').innerHTML = s;

}else{
alert(v.exception);
}
}
request.send();
} function commitWords(){
if (replyToId>0){
var title = "<span style='color:gray;'>回复 "+replyTo+":</span><br>";
replyToId=-1;
}else{

   title ="";
}
var words = comment_editor.getHtml();
words = words.trim();
if(words==""){
showInfo("resultInfo","留言内容不能为空!",true);
toEnable("btnSaveWords");
return ;
}
if(words.length>300){
showInfo("resultInfo","留言字数不能超过300",true);
toEnable("btnSaveWords");
return;
}
request.open("post","guestwords!save.do",false);
request.setParameter("words",title+words);
request.setParameter("owner",316683);
request.setParameter("replyTo",replyToId);
request.onresult=function(){
var v = request.getValue();
if(v.exception==null){
showGuestWords();
comment_editor.setContent('');
}else{
alert(v.exception);
}
showInfo("resultInfo","保存留言成功!",true);
toEnable("btnSaveWords");
su.$("btnSaveWords").value="留言";
su.$("commentTitle").style.display = "block";
su.$("replyTitle").style.display = "none";
}
request.send();
} function deleteWords(id){
 ShowMsgo.show("删除留言","确认要删除这条留言吗?",300,120);
 ShowMsgo.ok_callback=function(){deleteWds(id);}
 }
 function deleteWds(id)
 {
request.open("post","guestwords!delete.do",false);
request.setParameter("id",id);
request.onresult = function(){
var v = request.getValue();
if(v.exception==null){
showGuestWords();
}else{
alert(v.exception);
}
}
request.send();
} var replyTo ="";
var replyToId = -1;
function replyGuest(guest,guestId){
replyTo = guest;
replyToId = guestId;
su.$("commentTitle").style.display = "none";
su.$("replyTitle").style.display = "block";
su.$("replyTitle").innerHTML = "回复 "+guest;
su.$("btnSaveWords").value="回复";
window.location.href="#a_comment";
comment_editor.getFocus();
} function showPage(p){
var box = su.$("wordswall");
var elements = p.elements;
var sb = [];
var visitorId = 142962;
for(var i=0;i<elements.length;i++){
var one = elements[i];
var starstr='<a href="popularity!star.do">'+getStarStr(one.author.starLevel)+'</a>';
sb.push('<table width="590" border="0" cellspacing="0" cellpadding="0" class="mini_nr_list">');
sb.push(' <tr>');
sb.push('<td width="60" rowspan="2" align="center" valign="top"><a href="home!other.do?id='+one.author.id+'"><img src="'+one.author.photo_3+'"/></a> </td>');
sb.push('<td width="530" class="list_top"><div class="list_top_l"><a href="home!other.do?id='+one.author.id+'">'+one.author.name+'</a>'+starstr+'<span>('+one.author.city+') '+one.timeStr+'</span> </div>');
sb.push('<div class="list_top_r"> ');
if(visitorId==316683){
if(visitorId!=one.author.id)
sb.push('<a href="javascript:replyGuest(\''+one.author.name+'\','+one.author.id+');">回复</a>|');
sb.push('<a href="javascript:deleteWords('+one.id+');">删除</a> </div></td>');
}
sb.push(' </tr><tr>');
sb.push('<td width="530"><p>'+ubbToHtml(one.words)+'</p></td>');
sb.push(' </tr>');
sb.push('</table>');
}
box.innerHTML = sb.join("");
}  function modifyIntro() {
 
      var introdata = document.getElementById("introinfo").innerHTML;
      var texta = document.getElementById("infoedit");
  var t = texta.value;
  if (t.length>200){                
          t = t.substring(0, 200);
          texta.value=t;   
       }   
 
  if(t == introdata) {
  document.getElementById("user_zt").style.display = "none";
  return;
  }
  request.open("post","profile!updateIntro.do",false);
request.setParameter("intro",t);
request.onresult = function(){
document.getElementById("introinfo").innerHTML = t;
document.getElementById("introtime").innerHTML = "1秒钟前更新";
document.getElementById("user_zt").style.display = "none";
}
request.send();
 
 
  }  </script>
</div>
<!--留言板结束-->

解决方案 »

  1.   

    这个有意思,学习一下.
    楼主这些代码是网页代码吗?
    function showGuestWords(index,size){
            request.open("post","guestwords!list.do",true);
            if(index!=null){
                request.setParameter("pageIndex",index);
            }
            if(size!=null){
                request.setParameter("pageSize",size);
            }else{
                request.setParameter("pageSize",30);
            }
            request.setParameter("owner",316683);
            request.onresult = function(){
                var v = request.getValue();
      

  2.   

    WebBrowser加载完毕后,执行WebBrowser1.OleObject.Document.parentWindow.execScript('comment_editor.setContent("你的内容");','JavaScript');
      

  3.   

    对,常规提交方面不行的话,建议用JS脚本来做,肯定可以实现,如果用DELPHI来调用一段JS都不可以实现,那么这个网页本身也就不可以实现,因为网页本身也是用的这个脚本。还有一种方式是直接提交上去,根本不用填写表单再点提交这种效率极低的方法,不过写起来有些复杂。但用起来比较爽,网页一打开就提示留言成功。就像登录信箱一样,一打开网页就处于登录状态。