rendered paste body---- chat.php ----
<?php
$nick = $_POST['n'];
$action = $_POST['a'];
//echo "i made it this far<br />nick: ".$nick."<br />action: ".$action;
if($_POST['n']=="" || strlen($_POST['n'])<=3){
echo "
<div id=\"notice\" style=\"font-weight:bold;\">Nickname must be atleast 4 characters in length.</div>
<hr />
<div id=\"note\">Enter a nickname:</div>
<form method=\"post\" action=\"chat.php\" onsubmit=\"send_nick(this); return false;\">
<input type=\"text\" name=\"n\" size=\"30\" />
<input type=\"submit\" value=\"Continue ->\" name=\"btnSubmit\" />
</form> ";
} else {
echo "
<div id=\"notice\" style=\"font-weight:bold;\">Hello ".$nick.", Welcome to the chat.</div>
<hr />
<div id=\"note\">Type something below.</div>
<form method=\"post\" action=\"\" onsubmit=\"send_data(this); return false;\">
<input type=\"text\" name=\"ctext\" size=\"30\" />
<input type=\"submit\" value=\"Send\" name=\"btnSend\" />
</form>
<br />
<div id=\"container\">
<div id=\"head\"><b>Result:</b> </div>
<div id=\"replace_me\"></div>
</div> ";
}
?>
---- send_data() and display() funcs [line: 24]----
function send_data(form){
var data = form.ctext.value;
display(data);
}
function display(data) {
var p = document.createElement("P");
p.className = "chat_text";
p.appendChild( document.createTextNode(data) );
div.appendChild(p);
}