ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺟﻭﺮﺧ


فهرست مطالب

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


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺶﯾﺎﻤﻧ ﻥﺎﮑﻣﺍ

:ﺪﻫﺩ "ﺶﯾﺎﻤﻧ" ﻒﻠﺘﺨﻣ ﯼﺎﻫ ﺵﻭﺭ ﻪﺑ ﺍﺭ ﺎﻫ ﻩﺩﺍﺩ ﺪﻧﺍﻮﺗ ﯽﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

  • .innerHTML ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ ،HTML ﺮﺼﻨﻋ ﮏﯾ ﺭﺩ ﻦﺘﺷﻮﻧ

  • .document.write() ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ HTML ﯽﺟﻭﺮﺧ ﺭﺩ ﻦﺘﺷﻮﻧ

  • .window.alert() ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ ،ﺭﺍﺪﺸﻫ ﻪﺒﻌﺟ ﺭﺩ ﻦﺘﺷﻮﻧ

  • .console.log() ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ ،ﺮﮔﺭﻭﺮﻣ ﻝﻮﺴﻨﮐ ﺭﺩ ﻦﺘﺷﻮﻧ


innerHTML ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ

.ﺪﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ document.getElementById(id) ﺵﻭﺭ ﺯﺍ ﺪﻧﺍﻮﺗ ﯽﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ،HTML ﺮﺼﻨﻋ ﮏﯾ

:ﺪﻨﮐ ﯽﻣ ﻒﯾﺮﻌﺗ ﺍﺭ HTML ﯼﺍﻮﺘﺤﻣ innerHTML ﯽﮔﮋﯾﻭ .ﺪﻨﮐ ﯽﻣ ﻒﯾﺮﻌﺗ ﺍﺭ HTML ﺮﺼﻨﻋ

ﻝﺎﺜﻣ

<!DOCTYPE html>
<html>
<body>

<h1>My First Web Page</h1>
 <p>My First Paragraph</p>
    
<p id="demo"></p>

<script>
 document.getElementById("demo").innerHTML = 5 + 6;
    </script>

</body>
</html>

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

<!DOCTYPE html>
<html>
<body>

<h2>My First Web Page</h2>
<p>My First Paragraph.</p>

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

<script>
document.getElementById("demo").innerHTML = 5 + 6;
</script>

</body>
</html> 

HTML ﺮﺼﻨﻋ ﮏﯾ innerHTML ﯽﮔﮋﯾﻭ ﺮﯿﯿﻐﺗ


document.write() ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ

:ﺖﺳﺍ ﺖﺣﺍﺭ document.write() ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ،ﯽﺸﯾﺎﻣﺯﺁ ﻑﺍﺪﻫﺍ ﯼﺍﺮﺑ

ﻝﺎﺜﻣ

<!DOCTYPE html>
<html>
<body>
<h1>My First Web Page</h1>
 <p>My first paragraph.</p>
 
<script>
document.write(5 + 6);
</script>

</body>
</html>

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

<!DOCTYPE html>
<html>
<body>

<h2>My First Web Page</h2>
<p>My first paragraph.</p>

<p>Never call document.write after the document has finished loading.
It will overwrite the whole document.</p>

<script>
document.write(5 + 6);
</script>

</body>
</html> 

:ﺪﻨﮐ ﯽﻣ ﻑﺬﺣ ﺍﺭ ﺩﻮﺟﻮﻣ HTML ﻪﻤﻫ

ﻝﺎﺜﻣ

<!DOCTYPE html>
<html>
<body>

<h1>My First Web Page</h1>
 <p>My first paragraph.</p>

<button type="button" onclick="document.write(5 + 6)">Try it</button>

</body>
</html>

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

<!DOCTYPE html>
<html>
<body>

<h2>My First Web Page</h2>
<p>My first paragraph.</p>

<button type="button" onclick="document.write(5 + 6)">Try it</button>

</body>
</html> 

.ﺩﻮﺷ ﻩﺩﺎﻔﺘﺳﺍ ﺶﯾﺎﻣﺯﺁ ﯼﺍﺮﺑ ﺪﯾﺎﺑ ﻂﻘﻓ()document.write ﺪﺘﻣ



window.alert() ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ

:ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺭﺍﺪﺸﻫ ﻪﺒﻌﺟ ﺯﺍ ﺪﯿﻧﺍﻮﺗ ﯽﻣ ﺎﻫ ﻩﺩﺍﺩ ﺶﯾﺎﻤﻧ ﯼﺍﺮﺑ

ﻝﺎﺜﻣ

<!DOCTYPE html>
<html>
<body>

<h1>My First Web Page</h1>
<p>My first paragraph.</p>
 
<script>
window.alert(5 + 6);
</script>

</body>
</html>

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

<!DOCTYPE html>
<html>
<body>

<h2>My First Web Page</h2>
<p>My first paragraph.</p>

<script>
window.alert(5 + 6);
</script>

</body>
</html> 

.ﺪﯿﻨﮐ ﺮﻈﻧ ﻑﺮﺻ ﻩﺮﺠﻨﭘ<"code class="w3-codespan> ﯼﺪﯿﻠﮐ ﻪﻤﻠﮐ ﺯﺍ ﺪﯿﻧﺍﻮﺗ ﯽﻣ

.ﺪﻨﺘﺴﻫ ﻩﺮﺠﻨﭘ ﯽﺷ ﻪﺑ ﻖﻠﻌﺘﻣ ﺽﺮﻓ ﺶﯿﭘ ﺭﻮﻃ ﻪﺑ ﺎﻫﺪﺘﻣ ﻭ ﺎﻫ ﯽﮔﮋﯾﻭ ،ﺎﻫﺮﯿﻐﺘﻣ ﻪﮐ ﺖﺳﺍ ﯽﻨﻌﻣ ﻥﺍﺪﺑ ﻦﯾﺍ .ﺖﺳﺍ ﯽﻧﺎﻬﺟ ﻪﻨﻣﺍﺩ ءﯽﺷ ،ﻩﺮﺠﻨﭘ ﯽﺷ

ﻝﺎﺜﻣ

<!DOCTYPE html>
<html>
<body>

<h1>My First Web Page</h1>
<p>My first paragraph.</p>
 
<script>
alert(5 + 6);
</script>

</body>
</html>

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

<!DOCTYPE html>
<html>
<body>

<h2>My First Web Page</h2>
<p>My first paragraph.</p>

<script>
alert(5 + 6);
</script>

</body>
</html> 

console.log() ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ

.ﺪﯿﻨﮐ ﯽﻧﺍﻮﺧﺍﺮﻓ ﺍﺭ console.log() ﺵﻭﺭ ﺪﯿﻧﺍﻮﺗﯽﻣ ،ﯽﯾﺍﺩﺯﻝﺎﮑﺷﺍ ﻑﺍﺪﻫﺍ ﯼﺍﺮﺑ

.ﺖﺧﻮﻣﺁ ﺪﯿﻫﺍﻮﺧ ﯽﯾﺍﺩﺯ ﻝﺎﮑﺷﺍ ﺩﺭﻮﻣ ﺭﺩ ﺮﺘﺸﯿﺑ ﺪﻌﺑ ﻞﺼﻓ ﺭﺩ

ﻝﺎﺜﻣ

<!DOCTYPE html>
<html>
<body>
 
<script>
console.log(5 + 6);
</script>

</body>
</html>

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

<!DOCTYPE html>
<html>
<body>

<h2>Activate Debugging</h2>

<p>F12 on your keyboard will activate debugging.</p>
<p>Then select "Console" in the debugger menu.</p>
<p>Then click Run again.</p>

<script>
console.log(5 + 6);
</script>

</body>
</html> 

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﭖﺎﭼ

.ﺩﺭﺍﺪﻧ ﯽﭘﺎﭼ ﺵﻭﺭ ﺎﯾ ﯽﭘﺎﭼ ءﯽﺷ ﭻﯿﻫ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

.ﺪﯿﺷﺎﺑ ﻪﺘﺷﺍﺩ ﯽﺳﺮﺘﺳﺩ ﯽﺟﻭﺮﺧ ﯼﺎﻫ ﻩﺎﮕﺘﺳﺩ ﻪﺑ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺯﺍ ﺪﯿﻧﺍﻮﺗ ﯽﻤﻧ ﺎﻤﺷ

ﺭﺩ ﺍﺭ window.print() ﺪﺘﻣ ﺪﯿﻧﺍﻮﺗ ﯽﻣ ﻪﮐ ﺖﺳﺍ ﻦﯾﺍ ﺎﻨﺜﺘﺳﺍ ﺎﻬﻨﺗ

ﻝﺎﺜﻣ

<!DOCTYPE html>
<html>
<body>

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

</body>
</html>

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

<!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>

تمامی حقوق محفوظ است. © BasicIT.org • 2023-2024