C
CW
I have message entry screen that's causing me a bit of an issue. At the
moment, there are 2 buttons, one is used to send message to another user
(btnSend) and another is used to send messages to all users (btnSendAll).
When user hits enter, I also simulate the effect of clicking button
(btnSend). However, what I found btnSend doesn't fire (unless I click on the
button).
The postback function I call is as follows:
function __doPostBack(eventTarget, eventArgument)
{
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1)
{
theform = document.forms["Form1"];
}
else
{
theform = document.Form1;
}
theform.submit();
}
The script used to cause a postback is as follows:
<script language="javascript">
var mykey;
var posted=false;
if (window.Event){
document.captureEvents(Event.KEYDOWN);
}
document.onkeydown = myKeyDown;
function myKeyDown(e){
if (window.Event){
mykey = e.which;
}
else{
mykey = event.keyCode;
}
//alert(mykey);
if ((mykey==13) && (posted==false))
{
posted=true;
__doPostBack('btnSend:','onclick');
}
}
</script>
I think my problem is either not specifying eventTarget or eventArgument
correctly. Can someone please give a pointer on this.
Many thanx
moment, there are 2 buttons, one is used to send message to another user
(btnSend) and another is used to send messages to all users (btnSendAll).
When user hits enter, I also simulate the effect of clicking button
(btnSend). However, what I found btnSend doesn't fire (unless I click on the
button).
The postback function I call is as follows:
function __doPostBack(eventTarget, eventArgument)
{
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1)
{
theform = document.forms["Form1"];
}
else
{
theform = document.Form1;
}
theform.submit();
}
The script used to cause a postback is as follows:
<script language="javascript">
var mykey;
var posted=false;
if (window.Event){
document.captureEvents(Event.KEYDOWN);
}
document.onkeydown = myKeyDown;
function myKeyDown(e){
if (window.Event){
mykey = e.which;
}
else{
mykey = event.keyCode;
}
//alert(mykey);
if ((mykey==13) && (posted==false))
{
posted=true;
__doPostBack('btnSend:','onclick');
}
}
</script>
I think my problem is either not specifying eventTarget or eventArgument
correctly. Can someone please give a pointer on this.
Many thanx