function runOnKeys(func) {
var codes = [17, 13];
var pressed = [];
iDoc.onkeydown = function(e) {
e = e || iWin.event;
pressed[e.keyCode] = 1;
for(var i in codes) {
if (!pressed[codes[i]]) return;
}
pressed = [];
func();
};
iDoc.onkeyup = function(e) {
e = e || iWin.event;
delete pressed[e.keyCode];
};
}
function sendIframe() {
var clientmsg = iDoc.body.innerHTML;
$.post('post.php', { text: clientmsg }, function(data) {
iDoc.open();
iDoc.write(data);
iDoc.close();
});
}
runOnKeys(sendIframe);