1
Я создал Greasemonkey скрипт с целью:Greasemonkey: Добавление кнопки печать - печать и «печать дружественный» стиль ДИВ
- Добавить печать кнопку квитанций на 3-й участник веб-приложение странице
- Добавить чековый принтер дружественные стили Div в новом окне
- печати этого окно
кнопка показывает вверх, но это не вызывает мою функцию, которая в данный момент просто печатает DIV.
Вот где я нахожусь:
var scriptElement = document.createElement('script');
scriptElement.type = 'text/javascript';
scriptElement.innerHTML = 'function printReceipt() { \
var divToPrint=document.getEelementById("loanTable"); \
newWin= window.open(""); \
newWin.document.write(divToPrint.outerHTML); \
newWin.print(); \
newWin.close(); \
}';
document.getElementsByTagName("head")[0].appendChild(scriptElement);
window.addButton = function() {
// Get the location on the page where you want to create the button
var targetDiv = document.getElementById('newcheckout');
// Create a div to surround the button
var newDiv = document.createElement('div');
newDiv.setAttribute('id', 'autoCheckOrder');
// Create the button and set its attributes
var inputButton = document.createElement('input');
inputButton.name = 'autoCheckOrderButton';
inputButton.type = 'button';
inputButton.value = 'Print Receipt?';
inputButton.setAttribute("onclick", "printReceipt();");
// Append the button to the div
newDiv.appendChild(inputButton);
targetDiv.appendChild(newDiv);
}
addButton();
Спасибо! Я дам этот выстрел ... не могу поверить, сколько времени орфографические ошибки убивают. – Bubnoff
Работает, спасибо человеку! – Bubnoff
Добро пожаловать; рад помочь. –