צפיות
תשובות
עזרה בJS – SetTimeout
היי, אני מנסה לעשות סטייל קצת שונה מהסטיילים האחרים שיש.
אני רוצה שהמרחב בין כל אות לאות תגדל עם מעבר עכבר.
<script type="text/javascript">
var dodosduration = 550; // duration high = slower animation
step=0
function dodosflashtitle()
{ step++
if (step==3) {step=1}
if (step==1) {document.write('<style type="text/css">ul.menu li a.title{letter-spacing: 15px;}</style>')}
if (step==2) {document.write('<style type="text/css">ul.menu li a.title{letter-spacing: 19px;}</style>')}
setTimeout("dodosflashtitle()", dodosduration);
}
</script>
הבעיה היא שכשאני שם את העכבר על הקישור, אז העמוד מתרענן וכותב בHEAD (רק! בלי שום דבר בBODY) , אז כתוב לי במקור הדף בצורה כזאתי:
<html>
<head>
<style type="text/css">ul.menu li a.title{letter-spacing: 15px;}
<style type="text/css">ul.menu li a.title{letter-spacing: 19px;}
<style type="text/css">ul.menu li a.title{letter-spacing: 15px;}
<style type="text/css">ul.menu li a.title{letter-spacing: 19px;}
<style type="text/css">ul.menu li a.title{letter-spacing: 15px;}
<style type="text/css">ul.menu li a.title{letter-spacing: 19px;}
<style type="text/css">ul.menu li a.title{letter-spacing: 15px;}
<style type="text/css">ul.menu li a.title{letter-spacing: 19px;}
…….
….ועוד
</head>
</html>
(אני מצוטט מגוגל כרום)
וכשאני מנסה למחוק את הקוד
if (step==3) {step=1}
אז זה עושה לי אותו דבר רק שכתוב פעם אחת, אבל כנ"ל.. בלי הBODY.
הנה הקישור, רק בשביל שתדעו איך אני מפעיל אותו:
<ul>…..<li>…….בלהבלה וכל השאר
<a class="title" onmouseover="dodosflashtitle()" id="mashehoo">you</a>
תודה מראש לכל העוזרים.
1 תשובות
ואני חייב לציין שאני מאד מאד מאד מתחיל!
אני יודע דברים די בסיסיים, ואני בקורס של JS (כאן בוובמאסטר), לא מצאתי מאמר בנושא, וגם לא בשאלות נפוצות..
הנה הקוד המקורי שהעתקתי ושיניתי:
<script language="JavaScript">
var dodosflashtitle1='~ – Dior + Marina Birthday! – ~'; // put frame 1 text
var dodosflashtitle2='~ – Dior + mArina Birthday! – ~'; // put frame 2 text
var dodosflashtitle3='~ – Dior + maRina Birthday! – ~'; // put frame 3 text
var dodosflashtitle4='~ – Dior + marIna Birthday! – ~'; // put frame 4 text
var dodosflashtitle5='~ – Dior + mariNa Birthday! – ~'; // put frame 5 text
var dodosflashtitle6='~ – Dior + marinA Birthday! – ~'; // put frame 6 text
var dodosflashtitle5='~ – Dior + mariNa Birthday! – ~'; // put frame 7 text
var dodosflashtitle4='~ – Dior + marIna Birthday! – ~'; // put frame 8 text
var dodosflashtitle3='~ – Dior + maRina Birthday! – ~'; // put frame 9 text
var dodosflashtitle2='~ – Dior + mArina Birthday! – ~'; // put frame 10 text
var dodosduration = 250; // duration high = slower animation
step=0
function dodosflashtitle()
{ step++
if (step==7) {step=1}
if (step==1) {document.title=dodosflashtitle1}
if (step==2) {document.title=dodosflashtitle2}
if (step==3) {document.title=dodosflashtitle3}
if (step==4) {document.title=dodosflashtitle4}
if (step==5) {document.title=dodosflashtitle5}
if (step==6) {document.title=dodosflashtitle6}
if (step==7) {document.title=dodosflashtitle7}
if (step==8) {document.title=dodosflashtitle8}
if (step==9) {document.title=dodosflashtitle9}
if (step==10) {document.title=dodosflashtitle10}
setTimeout("dodosflashtitle()", dodosduration); }dodosflashtitle()
</script>
הוא מהאתר הקודם שלי.. דיאור תתעלמו מהטקסט.
שוב תודה