... | in chat.naml |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
<macro name="chat" requires="user">
<n.set_local_user.this_user />
<n.if.local_user.is_site_admin>
<then>
<div class="div-chat">
<table border="1">
<tr>
<td class="shouts">
</td>
</tr>
<tr>
<td class="input-chat">
<input type="text" />
</td>
</tr>
</table>
</div>
<script type="text/javascript">
$( document ).ready(function() {
$(".shouts").load( "/file/n11284/chat.xml" );
});
$("table input").keyup(function(event){
if(event.keyCode == 13){
$(".shouts").append('<p><span><n.visitor.name/>: </span>'+$("table input").val()+'</p>');
addLine("<p>test2</p>")
}
});
function addLine(text) {
xmlDoc=loadXMLDoc("/file/n11284/chat.xml");
newel=xmlDoc.createElement("p");
x=xmlDoc.getElementsByTagName("chat")[0];
x.appendChild(newel);
console.log(x);
xmlDoc=loadXMLDoc("/file/n11284/chat.xml");
y=xmlDoc.getElementsByTagName("p")[0].childNodes[0];
y.insertData(0,"Easy ");
console.log(x);
}
function loadXMLDoc(filename) {
if (window.XMLHttpRequest) {
xhttp=new XMLHttpRequest();
}
else {
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",filename,false);
xhttp.send();
return xhttp.responseXML;
}
</script>
</then>
</n.if.local_user.is_site_admin>
</macro>
|
Free forum by Nabble | Naml |