HTML DOM Document body property
- পূর্ববর্তী পৃষ্ঠা baseURI
- পরবর্তী পৃষ্ঠা charset
- একত্রিত স্তরে ফিরে যান HTML DOM Documents
Definition and Usage
body
properties set or return the document's <body> element.
Note:set body
properties will override all elements in the document <body>.
Hint
document.body
and document.documentElement
difference:
- document.body returns <body> element
- document.documentElement returns <html> element
অন্যান্য দেখুন:
উদাহরণ
উদাহরণ 1
Get the HTML content of the document:
const myBody = document.body.innerHTML;
উদাহরণ 2
Change the background color of the document:
document.body.style.backgroundColor = "yellow";
উদাহরণ 3
Change the document's <body> (overwrite all existing content):
document.body.innerHTML = "Some new HTML content";
উদাহরণ 4
Create <p> element and append it to the document body:
const para = document.createElement("p"); const node = document.createTextNode("This is a paragraph."); para.appendChild(node); document.body.appendChild(para);
সিন্তাক্স
return body property:
document.body
body প্রতিভূতি সংযোজন:
document.body = newContent
প্রতিভূতি মূল্য
মূল্য | বর্ণনা |
---|---|
newContent | নতুন কনটেন্ট <body> ইলেকট্রন |
ফলাফল
ধরন | বর্ণনা |
---|---|
বস্তু | ডকুমেন্টের body ইলেকট্রন |
ব্রাউজার সমর্থন
document.body
এটি DOM Level 1 (1998) বৈশিষ্ট্য
সমস্ত ব্রাউজারগুলি এটির সম্পূর্ণ সমর্থন করে:
Chrome | IE | এজ | ফায়ারফক্স | স্যাফারি | অপেরা |
---|---|---|---|---|---|
Chrome | IE | এজ | ফায়ারফক্স | স্যাফারি | অপেরা |
সমর্থন | 9-11 | সমর্থন | সমর্থন | সমর্থন | সমর্থন |
- পূর্ববর্তী পৃষ্ঠা baseURI
- পরবর্তী পৃষ্ঠা charset
- একত্রিত স্তরে ফিরে যান HTML DOM Documents