Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Webmaster Zone > Web Development
Register

Reply
 
LinkBack Thread Tools
Old 18.06.2007, 12:16   #1
I Love BMW!
 
ExtremeSM's Avatar
 
Join Date: 11 2006
Location: reload();
Posts: 63
Downloads: 2
Uploads: 0
Reputation: 0 | 0
Default JS not working...

Code:
 
<script>
function dot_change(obj) {
var prefix = "./images/";
if (document.all.obj.src == prefix + "dot.jpg") { document.all.obj.src = prefix + "dot_act.jpg"; }
if (document.all.obj.src == prefix + "dot_act.jpg") { document.all.obj.src = prefix + "dot.jpg"; }
if (document.all.obj.src == prefix + "dot_def.jpg") { document.all.obj.src = prefix + "dot_def.jpg"; }
}
</script>
 
 
<img id="id_1" src="./images/dot.jpg" width="20" height="20">
<a href="javascript:dot_change('id_1');">asdfghjkl</a>
uzum em poxi nkar@ click aneluc kamel mousover-ic... chi anum =\ asuma: document.all.obj.src is not an object... aysinqn chi stanum funkcian id_1 arjeq@... vonc karelia dzel???
Reply With Quote
Old 18.06.2007, 12:32   #2
dardanian
 
aeneas's Avatar
 
Join Date: 11 2005
Location: new troy
Posts: 175
Downloads: 8
Uploads: 0
Reputation: 9 | 0
Default

element = document.getElementById(id)
Reply With Quote
Old 20.06.2007, 13:07   #3
★★★★★★★★★★★★★
 
Hrach_Techie's Avatar
 
Join Date: 08 2004
Location: London, UK
Age: 38
Posts: 16,531
Downloads: 8
Uploads: 0
Reputation: 482 | 6
Default

Code:
<script>
function handle (iname, isrc)
{
    document[iname].src=isrc;
}
</script>

// call from event handler and pass args

<a href="my.html" onmouseover="handle('a', 'i2.jpg')" onmouseout="handle('a', 'i1.jpg')">
<img src="i1.jpg" width="20" height="10"
name="a" border="0">
</a>
Reply With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 15:35.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.