رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
[-]
اسلایدها

[-]
جدیدترین پست ها
بایوس لپ تاپ ایسر دارای پسورد است ولی ف...
نام سایت دیگر برای ه...پیمان — 04:16 PM
چگونه وارد بایوس سیستم شویم
برای اینکه بتوانید ه...پیمان — 12:04 AM
نصب ویندوز 11 بدون اتصال به شبکه
در نسخه های جدید وین...پیمان — 02:31 PM
بایوس لپ تاپ ایسر دارای پسورد است ولی فر...
برای بازکردن پسورد ب...پیمان — 08:52 PM
Headset EARLDOM
هدست:   EARLDOM  ارل...رویا — 12:25 PM

[-]
آخرین آمار انجمن
» Members: 26
» Latest member: آرین
» Forum threads: 416
» Forum posts: 633

Full Statistics

[-]
اهداف انجمن
31.7% of the way to our goal of 2,000 posts!
Only 1,367 posts left to go!

JavaScript Tutorial
#3
I want to print some HTML content, when the user clicks on a button. Once the user clicks on that button, the print dialog of the browser will open, but it will not print the webpage. Instead, it will print the some other HTML content which is not displayed on the page.

Place your printable part inside a div with an id like this:

نقل قول:<div id="printableArea">
      <h1>Print me</h1>
</div>

<input type="button" onclick="printDiv('printableArea')" value="print a div!" />
Now let's create a really simple javascript:

نقل قول:function printDiv(divName) {
    var printContents = document.getElementById(divName).innerHTML;
    var originalContents = document.body.innerHTML;

    document.body.innerHTML = printContents;

    window.print();

    document.body.innerHTML = originalContents;
}

Print a Page:

<!DOCTYPE html>
<html>
<body>

<h2>The window.print() Method</h2>

<p>Click the button to print the current page.</p>

<button onclick="window.print()">Print this page</button>

</body>
</html>
پاسخ


پیام‌های این موضوع
JavaScript Tutorial - توسط ترانه - 06-08-2020, 11:29 PM
RE: JavaScript Tutorial - توسط پیمان - 03-09-2020, 12:31 PM
RE: JavaScript Tutorial - توسط ترانه - 05-09-2020, 12:12 AM

پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان
[-]
خوش آمدید
You have to register before you can post on our site.

نام‌کاربری:


رمزعبور:





[-]
بیشترین مشارکت ها
no avatar Congratulations to رویا, our current top poster for the last month with 1 post!