בעיונת ב JavaScript - תכנות - HWzone פורומים
עבור לתוכן
  • צור חשבון

בעיונת ב JavaScript


trxman

Recommended Posts

אהלן !

אני רוצה לומר לדפדפן שיצבע את הקישור "בלה בלה" בצבע אדום , ע"פ המיקום שלו.

נגיד אם הבן אדם נמצא ב default אז הוא יהיה בצבע אדום,למשל.

כרגע סתם הצבתי את הכתובת ידנית...רק כדי לראות אם זה עובד אבל זה לא ! :ס

onLoad = yaba()

{ function pages()
{
return "file:///C:/Guy/Site2/Deafult.html";
}
function yaba()
{
if (document.location.href == pages())
{
alert('k its fine')
grund = document.getElementById("s")
grund.style.color = "red"


}
else
{alert('the url is '+document.location.href)}
}



}


וכמובן ב html יש:

<div class="details" ><a href=""><p id="s">ContactUs</p></a></div>

תודה רבה על העזרה! :}

קישור לתוכן
שתף באתרים אחרים

<html>
<body onLoad="yaba();">
<div><a href="" id="s">ContactUs</a></div>
</body>
</html>
<script>
function pages() {
return "file:///C:/Guy/Site2/Deafult.html";
}

function yaba() {
var myURL = document.location.href;
var myPage = pages();
if (myURL.toLowerCase() == myPage.toLowerCase()) {
alert('k its fine');
grund = document.getElementById("s");
grund.style.color = "red";
}else{
alert('the url is '+document.location.href);
}
}
</script>

קישור לתוכן
שתף באתרים אחרים

ארכיון

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

×
  • צור חדש...