JavaScript/תרגילים לחזרה: הבדלים בין גרסאות בדף
תוכן שנמחק תוכן שנוסף
←תשובות: שימוש ב <syntaxhighlight> |
|||
שורה 10:
==תשובות==
'''תרגיל א''''<br />
<
<html>
<head><title>katan o gadol</title>
שורה 21:
if(num<5)
{
document.write("המספר קטן מ-5")
}
else
{
document.write("המספר גדול מ-5")
}
</script>
שורה 31:
</body>
</html>
</syntaxhighlight>
<syntaxhighlight lang="html">
▲<br />'''תרגיל ב''''<br />
<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
</syntaxhighlight>
'''תרגיל ג''''
<syntaxhighlight lang="html">
<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>
[[קטגוריה:JavaScript|תרגילים לחזרה]]
|