הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   [HTML] תג target... (https://hosts.co.il/forums/showthread.php?t=47191)

darkid 09-06-07 14:30

[HTML] תג target...
 
שלום... במהלך קידוד אתרי ל"התאמה" לתקני הXHTML נתקלתי בבעיה בה תג Target אינו "מאושר"

הכוונה היא שהקוד:
HTML קוד:

<a href="bla.html" target="_blank">קישור</a>
אינו תקין.

התקלה:
קוד:

You have used the attribute named above in your document, but the
document type you are using does not support that attribute for this
element. This error is often caused by incorrect use of the "Strict"
document type with a document that uses frames (e.g. you must use
the "Transitional" document type to get the "target" attribute), or
by using vendor proprietary extensions such as "marginheight" (this
is usually fixed by using CSS to achieve the desired effect instead).   
This error may also result if the element itself is not supported in
the document type you are using, as an undefined element will have no
supported attributes; in this case, see the element-undefined error
message for further information.   
How to fix: check the spelling and case of the element and attribute,
(Remember XHTML is all lower-case) and/or
check that they are both allowed in the chosen document type, and/oR
use CSS instead of this attribute. If you received this error when using the
<embed> element to incorporate flash media in a Web page, see the
FAQ item on valid flash.

]

mayden 09-06-07 14:52

הפתרון בציטוט שלך:
קוד:

you must use
the "Transitional" document type to get the "target" attribute

אתה צריך להשתמש ב:
קוד:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">

וזה יעבוד, ואתה עכשיו משתמש בSTRICT, וSTRICT אינו תומך בזה.

darkid 09-06-07 15:04

כל שאר העיצוב מותאם ל STRICT...

אבל נבדוק, דקה.

עריכה:
צצים לי עשרות שגיאות אחרות עכשיו...

somebody 09-06-07 15:07

אין כזה דבר target.
הוא ירד בתקן.

אתה צריך לעשות משהו חלפי.
למשל פונקציה ב JS שתעשה את העבודה.

Daniel 09-06-07 15:10

HTML קוד:

<a href="LinkToOpenInNewWindow" onclick="window.open('URL');">Link</a>

mlnn 09-06-07 16:13

הבנתי שבגרסא הבאה רוצים להחזיר אותו =\

somebody 09-06-07 16:20

ציטוט:

<a href="LinkToOpenInNewWindow" onclick="window.open('URL');">Link</a>
לפי מה שעשית, מה שיקרא פשוט זה לפתוח חלון חדש, ולעבור לחלון אחר.
וחוץ מזה שאם תגיד לו לשים void(0);, כדי שזה לא יעבור, אז הבעיה תיהיה שזה לא יהיה טוב למנועי החיפוש, והם לא יוכלו לאנדקס את הכתובות.

אני ממליץ לך לעשות ככה:

HTML קוד:

function NewWin(URL)
{
window.open(URL);
return false;
}

<a href="http://www.fre.co.il" onclick="return NewWin(this.href);">aa</a>

פונקציה פשוטה, שמקבלת את הערך של HREF, ופותחת אותו בחלון חדש.
היא מחזיקה FALSE, כדי שהחלון הנוכחי, לא יעבור לכתובת של HREF גם כן.

THIS.HREF= הערך של HREF, אתה לא צריך לשנות אותו, הערך הזה מלא כבר ב HREF של אותו A.


כל הזמנים הם GMT +2. הזמן כעת הוא 00:32.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ