.ﺩﺍﺩ ﻡﺎﺠﻧﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺎﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ HTML ﻡﺮﻓ ﯽﺠﻨﺳ ﺭﺎﺒﺘﻋﺍ
ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻭ ﺪﻫﺩ ﯽﻣ ﺭﺍﺪﺸﻫ ﺍﺭ ﯽﻣﺎﯿﭘ ﻊﺑﺎﺗ ﻦﯾﺍ ،ﺪﺷﺎﺑ ﯽﻟﺎﺧ (fname) ﻡﺮﻓ ﺪﻠﯿﻓ ﮏﯾ ﺮﮔﺍ
function validateForm() {
let x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
:ﺩﺮﮐ ﯽﻧﺍﻮﺧﺍﺮﻓ ﺍﺭ ﻊﺑﺎﺗ ﻥﺍﻮﺗ ﯽﻣ ﻡﺮﻓ ﻝﺎﺳﺭﺍ ﻡﺎﮕﻨﻫ
<form name="myForm" action="/action_page.php" onsubmit="return validateForm()"
method="post">
Name: <input type="text" name="fname">
<input type="submit" value="Submit">
</form>
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<head>
<script>
function validateForm() {
let x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
</script>
</head>
<body>
<h2>JavaScript Validation</h2>
<form name="myForm" action="/action_page.php" onsubmit="return validateForm()" method="post">
Name: <input type="text" name="fname">
<input type="submit" value="Submit">
</form>
</body>
</html>
:ﺩﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﯼﺩﺪﻋ ﯼﺩﻭﺭﻭ ﯽﺠﻨﺳ ﺭﺎﺒﺘﻋﺍ ﯼﺍﺮﺑ ﺐﻠﻏﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ
ﺪﯿﻨﮐ ﺩﺭﺍﻭ 10 ﺎﺗ 1 ﻦﯿﺑ ﯼﺩﺪﻋ ﺎﻔﻄﻟ
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Validation</h2>
<p>Please input a number between 1 and 10:</p>
<input id="numb">
<button type="button" onclick="myFunction()">Submit</button>
<p id="demo"></p>
<script>
function myFunction() {
// Get the value of the input field with id="numb"
let x = document.getElementById("numb").value;
// If x is Not a Number or less than one or greater than 10
let text;
if (isNaN(x) || x < 1 || x > 10) {
text = "Input not valid";
} else {
text = "Input OK";
}
document.getElementById("demo").innerHTML = text;
}
</script>
</body>
</html>
:ﺩﺍﺩ ﻡﺎﺠﻧﺍ ﺮﮔﺭﻭﺮﻣ ﻂﺳﻮﺗ ﺭﺎﮐﺩﻮﺧ ﺭﻮﻃ ﻪﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ HTML ﻡﺮﻓ ﯽﺠﻨﺳ ﺭﺎﺒﺘﻋﺍ
.ﺪﻨﮐ ﯽﻣ ﯼﺮﯿﮔﻮﻠﺟ ﻡﺮﻓ ﻦﯾﺍ ﺩﻮﺟﻭ ﺯﺍ ﯼﺯﺎﯿﻧ<"code class="w3-codespan> ﯽﮔﮋﯾﻭ ،ﺪﺷﺎﺑ ﯽﻟ
<form action="/action_page.php" method="post">
<input type="text" name="fname" required>
<input type="submit" value="Submit">
</form>
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Validation</h2>
<form action="/action_page.php" method="post">
<input type="text" name="fname" required>
<input type="submit" value="Submit">
</form>
<p>If you click submit, without filling out the text field,
your browser will display an error message.</p>
</body>
</html>
.ﺪﻨﮐ ﯽﻤﻧ ﺭﺎﮐ ﻥﺁ ﺯﺍ ﻞﺒﻗ ﺎﯾ 9 ﺭﺭﻮﻠﭙﺴﮐﺍ ﺖﻧﺮﺘﻨﯾﺍ ﺭﺩ ﺭﺎﮐﺩﻮﺧ HTML ﻡﺮﻓ ﯽﺠﻨﺳ ﺭﺎﺒﺘﻋﺍ
،ﺮﺑﺭﺎﮐ ﯼﺩﻭﺭﻭ ﻥﺩﻮﺑ ﮎﺎﭘ ﺯﺍ ﻥﺎﻨﯿﻤﻃﺍ ﯼﺍﺮﺑ ﺖﺳﺍ ﯼﺪﻨﯾﺁﺮﻓ ﻩﺩﺍﺩ ﯽﺠﻨﺳ ﺭﺎﺒﺘﻋﺍ
:ﺯﺍ ﺪﻨﺗﺭﺎﺒﻋ ﯽﻟﻮﻤﻌﻣ ﯽﺠﻨﺳﺭﺎﺒﺘﻋﺍ ﯼﺎﻫﺭﺎﮐ
؟ﺖﺳﺍ ﻩﺩﺮﮐ ﺮﭘ ﺍﺭ ﻡﺯﻻ ﯼﺎﻫﺪﻠﯿﻓ ﻡﺎﻤﺗ ﺮﺑﺭﺎﮐ ﺎﯾﺁ
؟ﺖﺳﺍ ﻩﺩﺮﮐ ﺩﺭﺍﻭ ﺍﺭ ﯼﺮﺒﺘﻌﻣ ﺦﯾﺭﺎﺗ ﺮﺑﺭﺎﮐ ﺎﯾﺁ
؟ﺖﺳﺍ ﻩﺩﺮﮐ ﺩﺭﺍﻭ ﯼﺩﺪﻋ ﺪﻠﯿﻓ ﺭﺩ ﺍﺭ ﯽﻨﺘﻣ ﺮﺑﺭﺎﮐ ﺎﯾﺁ
.ﺖﺳﺍ ﺮﺑﺭﺎﮐ ﺢﯿﺤﺻ ﯼﺩﻭﺭﻭ ﺯﺍ ﻥﺎﻨﯿﻤﻃﺍ ﺎﻫ ﻩﺩﺍﺩ ﯽﺠﻨﺳﺭﺎﺒﺘﻋﺍ ﺯﺍ ﻑﺪﻫ ،ﺐﻠﻏﺍ
ﺖﻓﺭ ﺭﺎﮐ ﻪﺑ ﺎﻬﻧﺁ ﺯﺍ ﯼﺭﺎﯿﺴﺑ ﺭﺩ ﻭ ﺩﺮﮐ ﻒﯾﺮﻌﺗ ﯽﻔﻠﺘﺨﻣ ﯼﺎﻫ ﺵﻭﺭ ﺎﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ ﯽﺠﻨﺳ ﺭﺎﺒﺘﻋﺍ
ﺭﻭﺮﺳ ﺖﻤﺳ ﺭﺎﺒﺘﻋﺍ ﺪﯿﯾﺄﺗ ﺩﻮﺷ ﯽﻣ ﻡﺎﺠﻧﺍ ﺭﻭﺮﺳ ﻪﺑ ﯼﺩﻭﺭﻭ ﻝﺎﺳﺭﺍ ﺯﺍ ﺲﭘ ،ﺭﻭﺮﺳ ﺏ
.ﺩﻮﺷﯽﻣ ﻡﺎﺠﻧﺍ ﺏﻭ ﺮﮔﺭﻭﺮﻣ ﻂﺳﻮﺗ ﻩﺪﻧﺮﯿﮔ ﺲﯾﻭﺮﺳ ﺖﻤﺳ ﺭﺎﺒﺘﻋﺍ ﺪﯿﯾﺄﺗ ،ﺏﻭ ﺭ
HTML5 ﺪﯾﺪﺟ ﯽﺠﻨﺳ ﺭﺎﺒﺘﻋﺍ ﻡﻮﻬﻔﻣ ﮏﯾ HTML ﻡﺎﻧ ﻪﺑ ﺩﺮﮐ ﯽﻓﺮﻌﻣ ﺍﺭ ﺖﯾﺩﻭﺪﺤﻣ
:ﺖﺳﺍ ﺮﯾﺯ ﺩﺭﺍﻮﻣ ﺱﺎﺳﺍ ﺮﺑ HTML ﺖﯾﺩﻭﺪﺤﻣ ﯽﺠﻨﺳ ﺭﺎﺒﺘﻋﺍ
ﯼﺩﻭﺭﻭ ﯼﺎﻫﯽﮔﮋﯾﻭHTML ﺖﯾﺩﻭﺪﺤﻣ ﯽﺠﻨﺳﺭﺎﺒﺘﻋﺍ
ﺩﻮﺷ ﻝﺎﻌﻓﺮﯿﻏ ﺪﯾﺎﺑ ﯼﺩﻭﺭﻭ ﺮﺼﻨﻋ ﻪﮐ ﺪﻨﮐ ﯽﻣ ﺺﺨﺸﻣ
ﺪﻨﮐ ﯽﻣ ﺺﺨﺸﻣ ﺍﺭ ﯼﺩﻭﺭﻭ ﺮﺼﻨﻋ ﮏﯾ ﺭﺍﺪﻘﻣ ﺮﺜﮐﺍﺪﺣ
ﺪﻨﮐ ﯽﻣ ﺺﺨﺸﻣ ﺍﺭ ﯼﺩﻭﺭﻭ ﺮﺼﻨﻋ ﮏﯾ ﺭﺍﺪﻘﻣ ﻞﻗﺍﺪﺣ
ﺪﻨﮐ ﯽﻣ ﺺﺨﺸﻣ ﺍﺭ ﯼﺩﻭﺭﻭ ﺮﺼﻨﻋ ﮏﯾ ﺭﺍﺪﻘﻣ ﯼﻮﮕﻟﺍ
ﺩﺭﺍﺩ ﺯﺎﯿﻧ ﺮﺼﻨﻋ ﮏﯾ ﻪﺑ ﯼﺩﻭﺭﻭ ﺪﻠﯿﻓ ﻪﮐ ﺪﻨﮐ ﯽﻣ ﺺﺨﺸﻣ
ﺪﻨﮐ ﯽﻣ ﺺﺨﺸﻣ ﺍﺭ ﯼﺩﻭﺭﻭ ﺮﺼﻨﻋ ﻉﻮﻧ
ﺪﯾﻭﺮﺑ HTML ﻪﺑ ،ﻞﻣﺎﮐ ﺖﺴﯿﻟ ﯼﺍﺮﺑ
ﺪﻨﮐ ﯽﻣ ﺏﺎﺨﺘﻧﺍ ﻩﺪﺷ ﺺﺨﺸﻣ "ﻝﺎﻌﻓﺮﯿﻏ" ﯽﮔﮋﯾﻭ ﺎﺑ ﺍﺭ ﯼﺩﻭﺭﻭ ﺮﺻﺎﻨﻋ
ﺪﻨﮐ ﯽﻣ ﺏﺎﺨﺘﻧﺍ ﺍﺭ ﺮﺒﺘﻌﻣﺎﻧ ﺮﯾﺩﺎﻘﻣ ﺎﺑ ﯼﺩﻭﺭﻭ ﺮﺻﺎﻨﻋ
ﺪﻨﮐ ﯽﻣ ﺏﺎﺨﺘﻧﺍ "ﯽﻣﺍﺰﻟﺍ" ﻪﺼﺨﺸﻣ ﻥﻭﺪﺑ ﺍﺭ ﯼﺩﻭﺭﻭ ﺮﺻﺎﻨﻋ
ﺪﻨﮐ ﯽﻣ ﺏﺎﺨﺘﻧﺍ ﻩﺪﺷ ﺺﺨﺸﻣ "ﻡﺯﻻ" ﯽﮔﮋﯾﻭ ﺎﺑ ﺍﺭ ﯼﺩﻭﺭﻭ ﺮﺻﺎﻨﻋ
ﺪﻨﮐ ﯽﻣ ﺏﺎﺨﺘﻧﺍ ﺮﺒﺘﻌﻣ ﺮﯾﺩﺎﻘﻣ ﺎﺑ ﺍﺭ ﯼﺩﻭﺭﻭ ﺮﺻﺎﻨﻋ
ﺪﯾﻭﺮﺑ CSS ﻪﺑ ،ﻞﻣﺎﮐ ﺖﺴﯿﻟ ﯼﺍﺮﺑ