ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﻓﺮﻌﻣ


فهرست مطالب

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

.ﺪﻫﺩ ﻡﺎﺠﻧﺍ ﺪﻧﺍﻮﺗ ﯽﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﮐ ﺖﺳﺍ ﯽﯾﺎﻫﺭﺎﮐ ﺯﺍ ﻪﻧﻮﻤﻧ ﺪﻨﭼ ﻞﻣﺎﺷ ﻪﺤﻔﺻ ﻦﯾﺍ

ﺪﻫﺩ ﺮﯿﯿﻐﺗ ﺍﺭ HTML ﯼﺍﻮﺘﺤﻣ ﺪﻧﺍﻮﺗ ﯽﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

.ﺖﺳﺍ getElementById() ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ HTML ﯼﺎﻫ ﺵﻭﺭ ﺯﺍ ﯼﺭﺎﯿﺴﺑ ﺯﺍ ﯽﮑﯾ

،("ﻮﻣﺩ"=id ﺎﺑ) HTML ﺮﺼﻨﻋ ﮏﯾ "ﺖﻓﺎﯾ" ﺮﯾﺯ ﻝﺎﺜﻣ

ﻝﺎﺜﻣ

document.getElementById("demo").innerHTML = "Hello JavaScript";

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

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p id="demo">JavaScript can change HTML content.</p>

<button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>

</body>
</html>

:ﺩﺮﯾﺬﭘ ﯽﻣ ﺍﺭ ﯽﮑﺗ ﻢﻫ ﻭ ﯽﯾﺎﺗﻭﺩ ﯼﺎﻫ ﻝﻮﻗ ﻞﻘﻧ ﻢﻫ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

ﻝﺎﺜﻣ

document.getElementById('demo').innerHTML = 'Hello JavaScript';

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

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p id="demo">JavaScript can change HTML content.</p>

<button type="button" onclick="document.getElementById('demo').innerHTML = 'Hello JavaScript!'">Click Me!</button>

</body>
</html>

ﺪﻫﺩ ﺮﯿﯿﻐﺗ ﺍﺭ HTML ﯽﮔﮋﯾﻭ ﺮﯾﺩﺎﻘﻣ ﺪﻧﺍﻮﺗ ﯽﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

:ﺪﻫﺩﯽﻣ ﺮﯿﯿﻐﺗ ﺍﺭ <img> ﮓﺗ ﮏﯾ code class="w3-codespan">src (source)> ﯽﮔﮋﯾﻭ

ﭗﻣﻻ

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

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p>JavaScript can change HTML attribute values.</p>

<p>In this case JavaScript changes the value of the src (source) attribute of an image.</p>

<button onclick="document.getElementById('myImage').src='pic_bulbon.gif'">Turn on the light</button>

<img id="myImage" src="pic_bulboff.gif" style="width:100px">

<button onclick="document.getElementById('myImage').src='pic_bulboff.gif'">Turn off the light</button>

</body>
</html>


ﺪﻫﺩ ﺮﯿﯿﻐﺗ ﺍﺭ HTML (CSS) ﯼﺎﻫ ﮏﺒﺳ ﺪﻧﺍﻮﺗ ﯽﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

ﺖﺳﺍ HTML ﮏﯾ ﺮﯿﯿﻐﺗ ﯽﻋﻮﻧ ،HTML ﺮﺼﻨﻋ ﮏﯾ ﮏﺒﺳ ﺮﯿﯿﻐﺗ

ﻝﺎﺜﻣ

document.getElementById("demo").style.fontSize = "35px";

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

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p id="demo">JavaScript can change the style of an HTML element.</p>

<button type="button" onclick="document.getElementById('demo').style.fontSize='35px'">Click Me!</button>

</body>
</html> 

ﺪﻨﮐ ﻥﺎﻬﻨﭘ ﺍﺭ HTML ﺮﺻﺎﻨﻋ ﺪﻧﺍﻮﺗ ﯽﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

:ﺩﺍﺩ ﻡﺎﺠﻧﺍ ﺶﯾﺎﻤﻧ<"code class="w3-codespan> ﮏﺒﺳ ﺮﯿﯿﻐﺗ ﺎﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ HTML ﺮﺻﺎﻨﻋ ﻥﺩﺮﮐ ﻥﺎﻬﻨﭘ

ﻝﺎﺜﻣ

document.getElementById("demo").style.display = "none";

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

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p id="demo">JavaScript can hide HTML elements.</p>

<button type="button" onclick="document.getElementById('demo').style.display='none'">Click Me!</button>

</body>
</html> 

ﺪﻫﺩ ﻥﺎﺸﻧ ﺍﺭ HTML ﺮﺻﺎﻨﻋ ﺪﻧﺍﻮﺗ ﯽﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

:ﺩﻮﺷ ﻡﺎﺠﻧﺍ ﺶﯾﺎﻤﻧ<"code class="w3-codespan> ﮏﺒﺳ ﺮﯿﯿﻐﺗ ﺎﺑ ﺪﻧﺍﻮﺗ ﯽﻣ ﻦﯿﻨﭽﻤﻫ HTML ﻥﺎﻬﻨﭘ ﺮﺻﺎﻨﻋ ﺶﯾﺎﻤﻧ

ﻝﺎﺜﻣ

document.getElementById("demo").style.display = "block";

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

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p>JavaScript can show hidden HTML elements.</p>

<p id="demo" style="display:none">Hello JavaScript!</p>

<button type="button" onclick="document.getElementById('demo').style.display='block'">Click Me!</button>

</body>
</html> 

؟ﺪﯿﺘﺴﻧﺍﺪﯿﻣ ﺎﯾﺁ

ﺪﻨﺘﺴﻫ ﯽﺗﻭﺎﻔﺘﻣ ﻼًﻣﺎﮐ ﯼﺎﻫﻥﺎﺑﺯ ﻭﺩ ﺮﻫ ﺍﻭﺎﺟ ﻭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

.ﺪﺷ ﻞﯾﺪﺒﺗ ECMA ﺩﺭﺍﺪﻧﺎﺘﺳﺍ ﮏﯾ ﻪﺑ ﻭ ﺪﺷ ﻉﺍﺮﺘﺧﺍ 1995 ﻝﺎﺳ ﺭﺩ ﭻﯾﺍ ﻥﺍﺪﻧﺮﺑ ﻂﺳﻮﺗ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

ECMA-262 ﺖﺳﺍ ﺩﺭﺍﺪﻧﺎﺘﺳﺍ ﯽﻤﺳﺭ ﻡﺎﻧ. ECMAScript ﺖﺳﺍ ﻥﺎﺑﺯ ﻦﯾﺍ ﯽﻤﺳﺭ ﻡﺎﻧ.

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