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

appendChild - לא עובד קוד שנכתב ב-Javascript

Featured Replies

פורסם

שלום לכולם, את החופש הזה ניצלתי ללמוד כמה שפות שתרמו לי לפתח את האתר (Javascript , PHP וכו...) ואני דיי חדש אז יכול

להיות שאני עושה טעות טיפשית.

אני כותב בJavascript קוד ומייבא אותו למסמך HTML שלי, וניראה כי הקוד לא נוסף (לפי ה-LiveCode של DreamWeaver),

הינה הקוד שנמצא בתוך הקובץ itt.js:

function Setup()
{
var tooltip = document.createElement("div");
tooltip.setAttribute("id","itt");
document.getElementsByTagName("body")[0].appendChild(tooltip);
document.getElementById("itt").style.display = "none";
}
window.onload=Setup();

והינה מסמך ה HTML:

<html>
<head><title>Something</title>
<script type="text/javascript" src="itt.js"></script>
</head>
<body>
<a href="img.jpg">Test</a>

</body>
</html>

אשמח לדעת מה לא נכון בקוד ולמה שום דבר לא קורה,

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

ה-LiveCode (שמראה לי את הקוד של ה-HTML ברגע הממשי)

לא נוסף שום DIV והקוד נישאר בדיוק כפי שהיה.

אם אני לא טועה אמור להיות נוסף div חדש עם id ששווה ל-"itt"

אשמח לתגובות,

תודה רבה!

ארכיון

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

דיונים חדשים

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.