עבור לתוכן
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.

תקוע בבעיה בJS מספר ימים

Featured Replies

פורסם

function swapimges()

{

new_image = document.getElementById("onet");

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

{

new_image.src = "images/" + i + ".png";

}

}

תהנה.

פורסם
  • מחבר

תודה רבה לכלום ממש המון תודות , הצלחתי ליצור את המחליף תמונות שרציתי הכנסתי את זה למערך על מנת ליצור מצב שבו יש לי שלוש תמונות יתחלפו אוטמטיות כל שלוש וחצי שניות חוץ מאספלורר למישהוא יש אולי מושג למה?

הקוד שלי למקרא שמישהו יתחיל ללמוד כמוני וירצה אותו :





var i = 2;
var j = 0 ;
function swapimges()
{
var new_image = new Array();
new_image[0] = document.getElementById("onet");
new_image[1] = document.getElementById("onet1");
new_image[2] = document.getElementById("onet2");


new_image[j].src="images/"+i+".png";
i++;
j++;
if (i==7) i=1;
if (j==new_image.length) j=0;
}


function sw()
{


setInterval('swapimges()',3500);

}

יש לי שאלה נוספת. התמונות מסודרות אחת מתחת לשניה בצורה הבאה:






<ul id="middel_nav" class="block" >
<li><img id="onet" src="images/1.png" onLoad="sw()" width="100%" height="100%" > </li>
<li><img id="onet1" src="images/2.png"width="175px" height="100%"></li>

<li><img id="onet2" src="images/3.png"width="175px" height="100%"></li>

</ul>

האם ישנה דרך שבמקום לבנות מערך שעליו אני מכניס את השם שיש בID

אני יוכל פשוט לקרוא להם על ידי המיקום שלהם כלומר

block .1 יהיה שווה ל onet

block .2 יהיה שווה ל onet1:

וכדומה

ארכיון

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

דיונים חדשים

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.