ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻩﺮﺠﻨﭘ


فهرست مطالب

    نمایش فهرست مطالب


.ﺪﻨﮐ ﺖﺒﺤﺻ ﻥﺁ ﺎﺑ ﺎﺗ ﺪﻫﺩ ﯽﻣ ﻩﺯﺎﺟﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﺑ (BOM) ﺮﮔﺭﻭﺮﻣ ءﯽﺷ ﻝﺪﻣ


(BOM) ﺮﮔﺭﻭﺮﻣ ءﯽﺷ ﻝﺪﻣ

ﺩﺭﺍﺪﻧ ﺩﻮﺟﻭBrowser Object> ﯼﺍﺮﺑ ﯽﻤﺳﺭ ﺩﺭﺍﺪﻧﺎﺘﺳﺍ ﭻﯿﻫ

ﻭ ﺎﻫ ﺵﻭﺭ ﻥﺎﻤﻫ (ﺎًﺒﯾﺮﻘﺗ) ﻥﺭﺪﻣ ﯼﺎﻫﺮﮔﺭﻭﺮﻣ ﻪﮐ ﯽﯾﺎﺠﻧﺁ ﺯﺍ


ﻩﺮﺠﻨﭘ ﯽﺷ

ﺪﻫﺩ ﯽﻣ ﻥﺎﺸﻧ .ﺩﻮﺷ ﯽﻣ ﯽﻧﺎﺒﯿﺘﺸﭘ ﺎﻫﺮﮔﺭﻭﺮﻣ ﻪﻤﻫ ﻂﺳﻮﺗ ﻩﺮﺠﻨﭘ<"code class="w3-codespan>

ﺪﻧﻮﺷ ﯽﻣ ﻞﯾﺪﺒﺗ ﺭﺎﮐﺩﻮﺧ ﺭﻮﻃ ﻪﺑ ﯽﻧﺎﻬﺟ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫﺮﯿﻐﺘﻣ ﻭ ﻊﺑﺍﻮﺗ ،ءﺎﯿﺷﺍ ﻡﺎﻤﺗ

.ﺪﻨﺘﺴﻫ ﻩﺮﺠﻨﭘ ﯽﺷ ﯼﺎﻫ ﯽﮔﮋﯾﻭ ﯼﺮﺳﺍﺮﺳ ﯼﺎﻫﺮﯿﻐﺘﻣ

.ﺪﻨﺘﺴﻫ ﻩﺮﺠﻨﭘ ﯽﺷ ﯼﺎﻫﺪﺘﻣ ﯼﺮﺳﺍﺮﺳ ﻊﺑﺍﻮﺗ

ﺖﺳﺍ ﻩﺮﺠﻨﭘ ﯽﮔﮋﯾﻭ ﮏﯾ (HTML DOM ﺭﺩ) ﺪﻨﺳ ءﯽﺷ ﯽﺘﺣ

window.document.getElementById("header");

:ﻪﮐ ﺖﺴﻫ ﻦﯾﺍ ﻞﺜﻣ

document.getElementById("header");

ﻩﺮﺠﻨﭘ ﻩﺯﺍﺪﻧﺍ

ﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ ﯽﮔﮋﯾﻭ ﻭﺩ ﺯﺍ ﻥﺍﻮﺗ ﯽﻣ ﺮﮔﺭﻭﺮﻣ ﻩﺯﺍﺪﻧﺍ ﻦﯿﯿﻌﺗ ﯼﺍﺮﺑ

ﺪﻨﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺭﺩ ﺍﺭ ﺎﻫﻩﺯﺍﺪﻧﺍ ﯽﮔﮋﯾﻭ ﻭﺩ ﺮﻫ

  • window.innerHeight - (ﻞﺴﮑﯿﭘ ﺐﺴﺣ ﺮﺑ) ﺮﮔﺭﻭﺮﻣ ﻩﺮﺠﻨﭘ ﯽﻠﺧ

  • window.innerWidth - (ﻞﺴﮑﯿﭘ ﺐﺴﺣ ﺮﺑ) ﺮﮔﺭﻭﺮﻣ ﻩﺮﺠﻨﭘ ﯽﻠﺧﺍ

.ﺖﺴﯿﻧ ﺶﯾﺎﻤﯿﭘ ﯼﺎﻫﺭﺍﻮﻧ ﻭ ﺭﺍﺰﺑﺍ ﺭﺍﻮﻧ ﻞﻣﺎﺷ (ﺮﮔﺭﻭﺮﻣ ﺪﯾﺩ ﻩﺎﮔﺭﺩ) ﺮﮔﺭﻭﺮﻣ ﻩﺮﺠﻨﭘ

ﻝﺎﺜﻣ

let w = window.innerWidth;
let h = window.innerHeight;

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Window</h2>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
"Browser inner window width: " + window.innerWidth + "px<br>" +
"Browser inner window height: " + window.innerHeight + "px";
</script>

</body>
</html>

ﻩﺮﺠﻨﭘ ﯼﺎﻫ ﺵﻭﺭ ﺮﯾﺎﺳ

:ﺮﮕﯾﺩ ﺵﻭﺭ ﺪﻨﭼ

  • window.open() - ﺪﯿﻨﮐ ﺯﺎﺑ ﺪﯾﺪﺟ ﻩﺮﺠﻨﭘ ﮏﯾ

  • window.close() - ﺪﯾﺪﻨﺒﺑ ﺍﺭ ﯽﻠﻌﻓ ﻩﺮﺠﻨﭘ

  • window.moveTo() - ﺪﯿﻨﮐ ﺎﺠﺑﺎﺟ ﺍﺭ ﯽﻠﻌﻓ ﻩﺮﺠﻨﭘ

  • window.resizeTo() - ﯽﻠﻌﻓ ﻩﺮﺠﻨﭘ ﻩﺯﺍﺪﻧﺍ ﺮﯿﯿﻐﺗ