View Single Post
ישן 27-05-07, 21:23   # 1
Kfir.G
חבר וותיק
 
Kfir.G's Avatar
 
מיני פרופיל
תאריך הצטרפות: Dec 2005
הודעות: 1,059
שלח הודעה באמצעות ICO אל Kfir.G

Kfir.G לא מחובר  

בעיה עם getElemetById

טוב אז ככה כתבתי את הקוד הנ"ל
HTML קוד:
<script>
var i = 0;
function bop(){
if(i==0){
bla.innerText="olleH"
i++
}
else{
bla.innerText="Hello"
i--
}
}
</script>
<p id="bla"  width="100px">
Hello
</p>
<input type="button" value="Cilck on me and see what happends" id="bn1" class="bn" onclick="bop()" width="100px" />
עכשיו רציתי לשנות את זה ולכתוב בצורה הבאה
HTML קוד:
<script>
var i = 0;
function bop(){
var x = document.getElemetById("bla")
if(i==0){
x.innerText="olleH"
i++
}
else{
x.innerText="Hello"
i--
}
}
</script>
<p id="bla"  width="100px">
Hello
</p>
<input type="button" value="Cilck on me and see what happends" id="bn1" class="bn" onclick="bop()" width="100px" />
אבל מסיבה כלשהי זה לא עובד לי מה עשיתי לא נכון?

תודה מראש
__________________
פיג'מה
משחקים
  Reply With Quote