Ja, då kommer "lite" mera kod. ;)
<!--
var g_remoteServer = 'server.asp';
var g_intervalID=0;
var g_bWaitingForResp=0;
var g_iMsgTo=-1;
function callServer(sParams,bFromTimer) {
var head = document.getElementsByTagName('head').item(0);
var old = document.getElementById('lastLoadedCmds');
if (old){
if (bFromTimer && old.readyState=="loading"){
return;//let the old script complete
}
head.removeChild(old);
}
var sRn=Math.random();
script = document.createElement('script');
script.src = g_remoteServer+'?r='+ sRn + sParams;
script.type = 'text/javascript';
script.defer = true;
script.id = 'lastLoadedCmds';
void(head.appendChild(script));
}
function process_response(resp){
var sResp=String(resp);
var sMsg,sUsers,sRooms,sError;
//alert(sResp);
sError='';
if (sResp.length<1){
sError='response is empty';
return false;
}
aResp=sResp.split(String.fromCharCode(1));
if (aResp.length<3 || aResp.length>4){
timerClear();
sError='response contains ' + aResp.length + ' parts';
alert(sError);
return false;
}else{
sMsg=aResp[0];
sUsers=aResp[1];
sRooms=aResp[2];
if (aResp.length>3){
sError=aResp[3];
}
refresh_layers(sMsg,sUsers,sRooms,sError);
return true;
}
}
function rewriteLayer (id, html) {
if (String(html).length<1){
return;
}
if (document.layers) {
var l = document[id];
l.document.open();
l.document.write(html);
l.document.close();
}
else if (document.all && document.all[id]) {
document.all[id].innerHTML = html;
}
else if (document.createRange) {
var l = document.getElementById(id);
var r = document.createRange();
while (l.hasChildNodes())
l.removeChild(l.lastChild);
r.setStartAfter(l);
var docFrag = r.createContextualFragment(html);
l.appendChild(docFrag);
}
//document.location="#sndbox";
document.form1.mytext.focus();
}
function refresh_layers(sMsg,sUsers,sRooms,sError){
var sHtml;
[red]if (String(sMsg).length>0){
sHtml=format_msgs(sMsg);
window.focus();
rewriteLayer('[b]idDivMsgs[/b]',sHtml);[/red]
}
if (String(sUsers).length>0){
sHtml=format_users(sUsers);
rewriteLayer('idDivUsers',sHtml);
PrivateUserStyleUpd(g_iMsgTo);
}
if (String(sRooms).length>0){
sHtml=format_rooms(sRooms);
rewriteLayer('idDivRooms',sHtml);
}
if (String(sError).length>0){
act_on_error(sError);
}
return;
}
function format_msgs(sRaw){
var html=String(sRaw);
if (html.length<1) return '';
var re = new RegExp("\002\005","g");
html = html.replace(re,"</td></tr><tr><td nowrap class='NmC'>");
re = new RegExp("\002","g");
html = html.replace(re,"</td></tr><tr><td nowrap class='Nm'>");
re = new RegExp("\004\005","g");
html = html.replace(re,"</td></tr><tr><td nowrap class='NmPC'>");
re = new RegExp("\004","g");
html = html.replace(re,"</td></tr><tr><td nowrap class='NmP'>");
re = new RegExp("\003","g");
html = html.replace(re,":</td><td class='Msg' width='95%'>");
re = new RegExp("\006","g");
html = html.replace(re,"</td></tr><tr><td class='lIn' colspan=2><img src='/images/chat/door_in.gif' height=16 width=16>");
re = new RegExp("\007","g");
html = html.replace(re,"</td></tr><tr><td class='lOt' colspan=2><img src='/images/chat/door_out.gif' height=16 width=16>");
re = new RegExp("\010","g");
html = html.replace(re,"</td></tr><tr><td class='Inf' colspan=2>");
if (html.substring(0,5)=="</td>") html=html.substring(5,html.length);
if (html.substring(0,5)=="</tr>") html=html.substring(5,html.length);
html ="<table border='0' cellpadding='2' cellspacing='1' width='100%'>"+html+"</td></tr></table>";
<%If USE_IMAGE_SMILEY Then%>
re = new RegExp(":\\)","g");
html = html.replace(re,"<img src='/images/chat/smiley/9.gif' width=15 height=15 alt=':)'>");
re = new RegExp(":\\(","g");
html = html.replace(re,"<img src='/images/chat/smiley/7.gif' width=15 height=15 alt=':('>");
re = new RegExp(";\\)","g");
html = html.replace(re,"<img src='/images/chat/smiley/11.gif' width=15 height=15 alt=';)'>");
re = new RegExp(":\\]","g");
html = html.replace(re,"<img src='/images/chat/smiley/6.gif' width=15 height=15 alt=':]'>");
re = new RegExp(":\\[","g");
html = html.replace(re,"<img src='/images/chat/smiley/2.gif' width=15 height=15 alt=':['>");
re = new RegExp(":D","g");
html = html.replace(re,"<img src='/images/chat/smiley/3.gif' width=15 height=15 alt=':D'>");
re = new RegExp(":O","g");
html = html.replace(re,"<img src='/images/chat/smiley/8.gif' width=15 height=15 alt=':O'>");
re = new RegExp(":P","g");
html = html.replace(re,"<img src='/images/chat/smiley/10.gif' width=15 height=15 alt=':P'>");
re = new RegExp("O:-\\)","g");
html = html.replace(re,"<img src='/images/chat/smiley/1.gif' width=15 height=23 alt=''>");
re = new RegExp("xx\\(","g");
html = html.replace(re,"<img src='/images/chat/smiley/5.gif' width=15 height=15 alt='xx('>");
re = new RegExp(":-\\)","g");
html = html.replace(re,"<img src='/images/chat/smiley/9.gif' width=15 height=15 alt=':-)'>");
re = new RegExp(":o\\)","g");
html = html.replace(re,"<img src='/images/chat/smiley/4.gif' width=15 height=15 alt=':o)'>");
re = new RegExp(":-\\(","g");
html = html.replace(re,"<img src='/images/chat/smiley/7.gif' width=15 height=15 alt=':-('>");
re = new RegExp(":o\\(","g");
html = html.replace(re,"<img src='/images/chat/smiley/7.gif' width=15 height=15 alt=':o('>");
re = new RegExp(";-\\)","g");
html = html.replace(re,"<img src='/images/chat/smiley/11.gif' width=15 height=15 alt=';-)'>");
re = new RegExp(";o\\)","g");
html = html.replace(re,"<img src='/images/chat/smiley/11.gif' width=15 height=15 alt=';o)'>");
re = new RegExp(":-\\[","g");
html = html.replace(re,"<img src='/images/chat/smiley/2.gif' width=15 height=15 alt=':-['>");
re = new RegExp(":o\\[","g");
html = html.replace(re,"<img src='/images/chat/smiley/2.gif' width=15 height=15 alt=':o['>");
re = new RegExp(":-\\]","g");
html = html.replace(re,"<img src='/images/chat/smiley/6.gif' width=15 height=15 alt=':-]'>");
re = new RegExp(":o\\]","g");
html = html.replace(re,"<img src='/images/chat/smiley/6.gif' width=15 height=15 alt=':o]'>");
re = new RegExp("\\{\\)","g");
html = html.replace(re,"<img src='/images/chat/smiley/12.gif' width=16 height=15 alt='{)'>");
<%End If%>
return html;
}
function format_users(sRaw){
var html=String(sRaw);
if (html.length<1) return '';
var re = new RegExp("\004([0-9]+)\003([^\002]+)","g");//lets first find ourself there
html = html.replace(re,'<tr><td width=18><img src="/images/chat/person.gif" width=16 height=16 border=0 alt="$1"></td><td class="infCur">$2</td></tr>');
re = new RegExp("\002([0-9]+)\003([^\002\<]+)","g");//and now all the others
html = html.replace(re,'<tr><td width=18><img src="/images/chat/person.gif" width=16 height=16 border=0 alt="$1"></td><td class="infOth" id="usr_$1"><a href="javascript:PrivateModeSwitch($1,\'$2\')">$2</a>
[b][red]//<---! Det är här någonstans som den andra länken skall stå![/red][/b]</td></tr>');
html = '<table border=0 cellpadding=0 cellspacing=0 width="100%">'+html+'</table>';
return html;
}
function format_rooms(sRaw){
var html=String(sRaw);
if (html.length<1) return '';
var re=new RegExp("\002\004([0-9]+)\003([^\002]+)","g");
html=html.replace(re,'<tr><td width=18><a href="javascript:RemoveRoom_refresh($1)"><img src="/images/chat/group.gif" width=16 height=16 border=0></a></td><td class="infCur">$2</td></tr>');
re = new RegExp("\002([0-9]+)\003([^\002\<]+)","g");
html=html.replace(re,'<tr><td width=18><a href="javascript:RemoveRoom_refresh($1)"><img src="/images/chat/group.gif" width=16 height=16 border=0></a></td><td class="infOth"><a href="javascript:SwitchRoom_refresh($1)">$2</a></td></tr>');
html='<table border=0 cellpadding=1 cellspacing=0 width="100%">'+html+'</table>';
return html;
}
function act_on_error(sError){
var html=String(sError);
if (html.length<1) return;
var aResp=html.split(String.fromCharCode(2));
if (aResp.length<2){
alert("error:" + sError);
return;
}
var errCode=parseInt(aResp[0]);
if (errCode==1){
document.location="expired.asp"
}else if (errCode==3){
alert("error creatring room. " + aResp[1]);
}else if (errCode==4){
alert("error removing room. " + aResp[1]);
}else if (errCode==5){
alert("error switching room. " + aResp[1]);
}else if (errCode==12 || errCode==13){
alert("error sending message. " + aResp[1]);
}else{
alert("error code='" + aResp[0] + "'");
}
}
function send_msg(myText){
var sText=String(myText);
if (sText.length<1){
return;
}
var re = new RegExp("\\%","g");
sText=sText.replace(re,"%25");
re = new RegExp("\\+","g");
sText=sText.replace(re,"%2b");
re = new RegExp("\\#","g");
sText=sText.replace(re,"%23");
re = new RegExp("\\&","g");
sText=sText.replace(re,"%26");
callServer('&m='+ sText+ '&ut='+g_iMsgTo,0);
document.form1.mytext.value='';
}
function sections_refresh(isForseMsgs,isForseUsers,isForseRooms){
var iFlags=isForseMsgs | isForseUsers<<1 | isForseRooms<<2;
//alert(iFlags);
callServer('&f='+iFlags,0);
document.form1.mytext.value='';
return;
}
function addRoom_refresh(){
var sRoomName=document.frmAddRoom.addroomname.value;
if (String(sRoomName).length<1){
return;
}
callServer('&ra='+sRoomName,0);
document.frmAddRoom.addroomname.value='';
}
function RemoveRoom_refresh(roomid){
' Här kommer ännu mera kod
//-->
MVH Jesper