.ﻥﻼﻋﺍ ﻪﺒﻌﺟ ﻭ ﺪﯿﯾﺄﺗ ﺭﺩﺎﮐ ،ﺭﺍﺪﺸﻫ ﻪﺒﻌﺟ :ﺖﺳﺍ ﻮﺷﺯﺎﺑ ﻩﺮﺠﻨﭘ ﻉﻮﻧ ﻪﺳ ﯼﺍﺭﺍﺩ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ
.ﺩﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺭﺍﺪﺸﻫ ﻪﺒﻌﺟ ﺯﺍ ﺐﻠﻏﺍ ،ﺪﺳﺭ ﯽﻣ ﺮﺑﺭﺎﮐ ﻪﺑ ﺕﺎﻋﻼﻃﺍ ﺪﯾﻮﺷ ﻦﺌﻤﻄﻣ ﺪﯿﻫﺍﻮﺧ ﯽﻣ ﺮﮔﺍ
.ﺪﻨﮐ ﮏﯿﻠﮐ "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>