JavaScript/תרגילים לחזרה: הבדלים בין גרסאות בדף

תוכן שנמחק תוכן שנוסף
←‏תשובות: שימוש ב <syntaxhighlight>
שורה 10:
==תשובות==
'''תרגיל א''''<br />
<sourcesyntaxhighlight lang="texthtml">
<html>
<head><title>katan o gadol</title>
שורה 21:
if(num<5)
{
document.write("המספר קטן מ-5")
}
else
{
document.write("המספר גדול מ-5")
}
</script>
שורה 31:
</body>
</html>
</syntaxhighlight>
 
<br />'''תרגיל ב''''<br />
</source>
<syntaxhighlight lang="html">
<br />'''תרגיל ב''''<br />
<source lang="text">
<html>
<head><title>katan o gadol o shave</title>
שורה 45 ⟵ 44:
if(num==5)// בודקים אם המשתנה נאם שווה ל-5
{
document.write("The number is 5 ");
}
else if(num<5)
{
document.write("The number is smaller then 5 ");
}
else
{
document.write("The number is bigger then 5 ");
}
</script>
 
</p>
</body>
</html></source>
</syntaxhighlight>
<br />
'''תרגיל ג''''
<syntaxhighlight lang="html">
<br />
<source lang="text">
<html>
<head><title>A is good</title>
שורה 75 ⟵ 72:
 
switch(letter) {
case "A":// A בודקים אם
document.write("A is good ");
break;
case "B":
document.write("B is like me ");
break;
case "C":
document.write("C is the big one ");
break;
 
default:
document.write("A is good ");
document.write("your letter is pretty ");
break;
case"B":
 
 
document.write("B is like me ");
 
 
 
break;
case"C":
 
 
document.write("C is the big one ");
break;
default:
 
document.write("your letter is pretty ");
}
 
 
</script>
 
</p>
שורה 105 ⟵ 91:
</html>
 
</syntaxhighlight>
</source>
 
[[קטגוריה:JavaScript|תרגילים לחזרה]]