开发者

Receive Events in a javascript and print it in a separate window?

I have a pushlet in my project which receives the 开发者_Go百科push events (i.e.,) if a user click on some buttons it will get the action and sends the message to the main jsp page through a javascript. Now, i have received datas through the pushlet and retrieved those in a javascript.

function setUserDataEvent(UserDataEvent) {
try {
   alert(UserDataEvent);
}
catch(er) {
}
}

Where userDataEvent is the event which i received through pushlet. I am getting continuous alerts like for eg.,(a=b) and then (c=d). I have to receive get those values and then print those in a separate window in javascript using window.open().... Any suggestions???????


I think you have to go over a cookie. Save the event data in a cookie, then open the window and then, in your script in the window, read the data and delete the cookie.


I arrived at a solution and its working fine!!!!!

var testWindow;
var testData="";
function setUserDataEvent(UserDataEvent) {
try {
if(!testData) {
   testData = UserDataEvent;
} else {
   testData += UserDataEvent;
}
if(!testWindow) {
   var x = 235;
   var y = 370;
   testWindow = window.open('','q',"location=no,directories=no,status=no,menubar=no,scrollbars=no,resize=no,width=" + x + ",height=" + y);
}
   testWindow.document.write(testData);
   testWindow.document.close();
   testWindow.focus();


}
catch (er)
{

}
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜