עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

תוכנית ב-java script

Featured Replies

פורסם

שלום נתנו לי לבנות תוכנית (תרגיל מספר) שמציגה על המסך טבלה בגודל 6X6

גובה כל תא 30 נקודות ורוחבו 30 נקודות

צבע התאים בעמודות (משמאל לימין) הוא: אדום, כחול, צהוב, ירוק, אפור, ורוד.

בשורה הראשונה רק תא אחד צבוע (התא השמאלי ביותר), בשורה השנייה רק שני תאים צבועים (השמאליים ביותר) וכך הלאה, עד שבשורה השישית כל התאים

צבועים.

ניסיתי ולא בדיוק הצלחתי, הנה מה שכתבתי:

<html>

<head>

<title>6-05</title>

<script language="javascript">

var i ;

var j ;

document.write("<table border='1' cellpadding='3'") ;

for ( i = 0 ; i <= 5 ; i++ )

{

document.write("<tr height='30'>") ;

for ( j = 0 ; j <= 5 ; j++ )

{

if ((j < 1)&&(i < 6))

{

{

document.write("<td width='30' bgcolor='red'>" + "<br />" + "</td>");

}

if ((j < 2)&&(i > 0))

{

document.write("<td width='30' bgcolor='blue'>" + "<br />" + "</td>");

}

if ((j < 3)&&(i > 1))

{

document.write("<td width='30' bgcolor='yellow'>" + "<br />" + "</td>");

}

if ((j < 4)&&(i > 2))

{

document.write("<td width='30' bgcolor='green'>" + "<br />" + "</td>");

}

if ((j < 5)&&(i > 3))

{

document.write("<td width='30' bgcolor='gray'>" + "<br />" + "</td>");

}

if ((j < 6)&&(i > 4))

{

document.write("<td width='30' bgcolor='pink'>" + "<br />" + "</td>");

}

}

else

document.write("<td width='30'>" + "<br />" + "</td>");

}

document.write("</tr>");

}

document.write("</table>");

</script>

</head>

<body>

</body>

</html>

פורסם

עדיף שתעשה את זה בלי לולאה.

פורסם
<html>

<head>
<title>6-05</title>
<script type="text/javascript">
var i ;
var j ;
var colors = new Array();
colors[0] = "red";
colors[1] = "blue";
colors[2] = "yellow";
colors[3] = "green";
colors[4] = "gray";
colors[5] = "pink";
document.write("<table border='1' cellpadding='3'") ;
for ( i = 0 ; i <= 5 ; i++ ){
document.write("<tr height='30'>") ;
for ( j = 0 ; j <= i ; j++ ){
document.write("<td width='30' bgColor="+colors[j]+">" + colors[j] + "</td>");
}
for ( j = j ; j <= 5 ; j++ ){
document.write("<td width='30'>" + "<br />" + "</td>");
}
document.write("</tr>");
}
document.write("</table>");
</script>
</head>

<body>

</body>

</html>

פורסם
  • מחבר

תודה אחי אבל איך אני עושה שבמשבצות לא יהייה כתוב כלום?

פורסם

במקרה הזה - BR

פורסם
  • מחבר

ניסיתי זה לא עובד.

פורסם

עובד כמו גדול

<html>

<head>
<title>6-05</title>
<script type="text/javascript">
var i ;
var j ;
var colors = new Array();
colors[0] = "red";
colors[1] = "blue";
colors[2] = "yellow";
colors[3] = "green";
colors[4] = "gray";
colors[5] = "pink";
document.write("<table border='1' cellpadding='3'") ;
for ( i = 0 ; i <= 5 ; i++ ){
document.write("<tr height='30'>") ;
for ( j = 0 ; j <= i ; j++ ){
document.write("<td width='30' bgColor="+colors[j]+"><br /></td>");
}
for ( j = j ; j <= 5 ; j++ ){
document.write("<td width='30'>" + "<br />" + "</td>");
}
document.write("</tr>");
}
document.write("</table>");
</script>
</head>

<body>

</body>

</html>

פורסם
  • מחבר

תודה!

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.