抱歉我的英文
func 1:当我调用此函数时,它会打开一个带有FORM的小盒子(div)。
func 2:当我在func 1中发送FORM时,需要将'bbb'div中的'aaa'替换为'vvv'
我不知道为什么,当我发送FORM(在func 1中)运行函数2,并将其替换为'aaa'到'vvv',但是在1-2秒后刷新所有页面,我不知道原因。
有人有解决方案吗?
<!-- func 1 -->
var bottom = "";
var div = new Array(4);
var count = 0;
function chat(mem_id) {
count++;
var div_new = "<div style='position:absolute; width:200px; bottom:0px; left:10px;'>";
div_new = div_new+"<div style='width:100%; background-color:green;'>top "+ mem_id +" - "+count+"</div>";
div_new = div_new+"<div style='width:100%; height:300px; background-color:pink;'>bottom // refresh_chat"+ mem_id +" ";
var name = "send_chat_"+mem_id;
var url = "send_chat.php";
div_new = div_new+"<form name='"+name+"' onsubmit=\" return ref('ffff', 'vvvv' ); \" method='post' style='display:inline;'>";
div_new = div_new+"<textarea name='"+name+"' autofocus=autofocus placeholder='"+name+"'></textarea><input type=submit value=' send '>";
div_new = div_new+"</form>";
div_new = div_new+"</div><div id='bbb'> aaa </div>";
div_new = div_new+"</div>";
bottom = div_new;
document.getElementById('bottom').innerHTML = bottom;
}
<!-- func 2 -->
function ref(aaa, bbb) {
document.getElementById('bbb').innerHTML = bbb;
}