var invoiceWindow=window.open('','','width=1,height=1,location=NO,locationbar=NO,menubar=YES,screenX=100,screenY=100');
invoiceWindow.document.write("hallo, this is new window");
invoiceWindow.document.close(); // --> Sehr wichtig
invoiceWindow.print();
invoiceWindow.close();
2008年11月4日星期二
javascript 打印print 窗口
2008年9月23日星期二
Prototype JS Event.observe
Event.observe(window, 'load', function()
{
Event.observe( 'searchBt', 'click', function(e)
{
ajaxListReceiver('{$clientId}');
getWinnerCount(0);
Event.stop(e);
});
});
var phrase = "This is SPAARRTTAAAA!";
$('somelink').observe('click', sayIt.bindAsEventListener(this, phrase));
function sayIt(event, phrase) {
console.log(phrase);
}
phrase = "Red sauce on PAASTAAAA!";
var obj = { name: 'A nice demo' };
function handler(e) {
var tag = Event.element(e).tagName.toLowerCase();
var data = $A(arguments);
data.shift();
alert(this.name + '\nClick on a ' + tag + '\nOther args: ' + data.join(', '));
}
Event.observe(document.body, 'click', handler.bindAsEventListener(obj, 1, 2, 3));
// Now any click on the page displays obj.name, the lower-cased tag name
// of the clicked element, and "1, 2, 3".
/*
* add click event
*
*/
// Attaching events
for (var i = items.length; i--; ) {
Event.observe(items[i], 'click', e_onclick, false);
}
// Detaching events
for (var i = items.length; i--; ) {
Event.stopObserving(items[i], 'click', e_onclick, false);
}
/*
* add click event with "return false"
*
*/
in html file:
Event.observe(window, 'load', function() {
Event.observe('button2', 'click', onchecktime);
});
if js file:
var onchecktime = function(event){
var element = Event.element(event);
alert(Event.pointerX(event));
Event.stop(event); // avoid page reloading
};
订阅:
博文 (Atom)