1
爲了在我的頁面框架上打印一組數據,我創建了一個javascript function
以將其設置爲a
標記上的onClick
。但是,該功能只是在點擊打印時僅獲得一個參數,而不是全部。將兩個函數參數應用於onClick標記
所以我做了HTML:
<div id="services">Services available</div>
<div id="products">Products available</div>
和JavaScript函數(兩個參數):
function Popup(data1, data2) {
var printWindow = window.open('', 'Page', 'width=600,height=600,left=400');
printWindow.document.write(data1);
printWindow.document.write(data2);
return true;
}
function PrintElem(elem1, elem2) {
Popup($(elem1, elem2).html());
}
而且a
標籤設置爲被點擊並打開一個彈出窗口。窗戶被打開,與提供的服務,但產品不會出現和輸出undefined
<a onClick="PrintElem('#services, #products')">Print page</a>
我怎樣才能讓閱讀功能都IDS?
抓住了我,因爲我是編輯它@KJPrice :)看準那之後我做了回答第一個問題。 – epascarello