ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﭖﺁ ﭖﺎﭘ ﯼﺎﻫ ﻪﺒﻌﺟ


فهرست مطالب

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


.ﻥﻼﻋﺍ ﻪﺒﻌﺟ ﻭ ﺪﯿﯾﺄﺗ ﺭﺩﺎﮐ ،ﺭﺍﺪﺸﻫ ﻪﺒﻌﺟ :ﺖﺳﺍ ﻮﺷﺯﺎﺑ ﻩﺮﺠﻨﭘ ﻉﻮﻧ ﻪﺳ ﯼﺍﺭﺍﺩ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ


ﺭﺍﺪﺸﻫ ﻪﺒﻌﺟ

.ﺩﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺭﺍﺪﺸﻫ ﻪﺒﻌﺟ ﺯﺍ ﺐﻠﻏﺍ ،ﺪﺳﺭ ﯽﻣ ﺮﺑﺭﺎﮐ ﻪﺑ ﺕﺎﻋﻼﻃﺍ ﺪﯾﻮﺷ ﻦﺌﻤﻄﻣ ﺪﯿﻫﺍﻮﺧ ﯽﻣ ﺮﮔﺍ

.ﺪﻨﮐ ﮏﯿﻠﮐ "OK" ﯼﻭﺭ ﻪﻣﺍﺩﺍ ﯼﺍﺮﺑ ﺪﯾﺎﺑ ﺮﺑﺭﺎﮐ ،ﺩﻮﺷ ﯽﻣ ﺮﻫﺎﻇ ﺭﺍﺪﺸﻫ ﻪﺒﻌﺟ ﮏﯾ ﻪﮐ ﯽﻣﺎﮕﻨﻫ

ﻮﺤﻧ

window.alert("sometext");

ﺖﺷﻮﻧ ﻩﺮﺠﻨﭘ ﻥﻭﺪﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ window.alert() ﺵﻭﺭ

ﻝﺎﺜﻣ

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Alert</h2>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
  alert("I am an alert box!");
}
</script>

</body>
</html>

ﺪﯿﯾﺎﺗ ﺭﺩﺎﮐ

.ﺩﻮﺷﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺪﯿﯾﺄﺗ ﺭﺩﺎﮐ ﺯﺍ ﺐﻠﻏﺍ ،ﺪﻨﮐ ﻝﻮﺒﻗ ﺎﯾ ﺪﯿﯾﺄﺗ ﺍﺭ ﯼﺰﯿﭼ ﺮﺑﺭﺎﮐ ﺪﯿﻫﺍﻮﺧﯽﻣ

.ﺪﻨﮐ ﮏﯿﻠﮐ «Cancel» ﺎﯾ «OK» ﯼﻭﺭ ﻪﻣﺍﺩﺍ ﯼﺍﺮﺑ ﺪﯾﺎﺑ ﺮﺑﺭﺎﮐ ،ﺩﻮﺷ ﯽﻣ ﺮﻫﺎﻇ ﺪﯿﯾﺄﺗ ﺭﺩﺎﮐ ﮏﯾ ﻪﮐ ﯽﻣ

ﺩﺩﺮﮔ ﯽﻣ ﺯﺎﺑ ﺭﺩﺎﮐ ،ﺪﻨﮐ ﮏﯿﻠﮐ "ﻮﻐﻟ" ﯼﻭﺭ ﺮﺑﺭﺎﮐ ﺮﮔﺍ .ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ true

ﻮﺤﻧ

window.confirm("sometext");

.ﺖﺷﻮﻧ ﻩﺮﺠﻨﭘ ﺪﻧﻮﺸﯿﭘ ﻥﻭﺪﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ window.confirm()

ﻝﺎﺜﻣ

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Confirm Box</h2>


<button onclick="myFunction()">Try it</button>

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

<script>
function myFunction() {
  var txt;
  if (confirm("Press a button!")) {
    txt = "You pressed OK!";
  } else {
    txt = "You pressed Cancel!";
  }
  document.getElementById("demo").innerHTML = txt;
}
</script>

</body>
</html>


ﻥﻼﻋﺍ ﻪﺒﻌﺟ

.ﺩﻮﺷﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﻥﻼﻋﺍ ﻪﺒﻌﺟ ﮏﯾ ﺯﺍ ﺐﻠﻏﺍ ،ﺪﻨﮐ ﺩﺭﺍﻭ ﺍﺭ ﯼﺭﺍﺪﻘﻣ ﻪﺤﻔﺻ ﻪﺑ ﺩﻭﺭﻭ ﺯﺍ ﻞﺒﻗ ﺮﺑﺭﺎ

.ﺪﻨﮐ ﮏﯿﻠﮐ "Cancel" ﺎﯾ "OK" ﯼﻭﺭ ﺪﯾﺎﺑ ﺮﺑﺭﺎﮐ ،ﺩﻮﺷ ﯽﻣ ﺮﻫﺎﻇ ﻥﻼﻋﺍ ﺭﺩﺎﮐ ﮏﯾ ﻪﮐ ﯽﻣﺎﮕﻨﻫ

.ﺩﺩﺮﮔ ﯽﻣﺮﺑ ﺮﻔﺻ ﺭﺩﺎﮐ ،ﺪﻨﮐ ﮏﯿﻠﮐ "ﻮﻐﻟ" ﯼﻭﺭ ﺮﺑﺭﺎﮐ ﺮﮔﺍ .ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﯼﺩﻭﺭﻭ ﺭﺍﺪﻘﻣ ﺭﺩﺎ

ﻮﺤﻧ

window.prompt("sometext","defaultText");

.ﺖﺷﻮﻧ ﻩﺮﺠﻨﭘ ﺪﻧﻮﺸﯿﭘ ﻥﻭﺪﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ window.prompt()

ﻝﺎﺜﻣ

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Prompt</h2>

<button onclick="myFunction()">Try it</button>

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

<script>
function myFunction() {
  let text;
  let person = prompt("Please enter your name:", "Harry Potter");
  if (person == null || person == "") {
    text = "User cancelled the prompt.";
  } else {
    text = "Hello " + person + "! How are you today?";
  }
  document.getElementById("demo").innerHTML = text;
}
</script>

</body>
</html>

ﺪﻨﮑﺷ ﯽﻣ ﻂﺧ

.ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ n ﺮﺘﮐﺍﺭﺎﮐ ﻝﺎﺒﻧﺩ ﻪﺑ ﻭ ﺐﻘﻋ ﻪﺑ ﺶﻠﺳﺍ ﮏﯾ ﺯﺍ ،ﻮﺷﺯﺎﺑ ﺭﺩﺎﮐ ﮏﯾ ﺭﺩ ﻂﺧ ﯼﺎﻫﻪﺘﺴ

ﻝﺎﺜﻣ

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript</h2>
<p>Line-breaks in a popup box.</p>

<button onclick="alert('Hello\nHow are you?')">Try it</button>

</body>
</html>