Tell me, please, who knows! There are pictures. It is necessary that when you click one of them on it with the mouse, they are replaced by another and so on.
- This is not related to html. This is javascript. - Zow
- This is the minimum CSS. In pure HTML, you do not like this unfortunately. - BomBom
- and how on javascript it will be? Do not know? - Anton
- By clicking on an object, a function is called that changes something in the document - Zow
- one@ Anton to you Tipo for school - Zow
|
1 answer
<html> <head> <script> function change(evt){ if(window.event){ img=window.event.srcElement; } else{ img=evt.target; } img.src="новое значение атрибута src"; } </script> </head> <body> <img src="стандарное значение аттрибута src" onclick="change()"> </body> </html>
- sorry and how to do the URL tell me - Anton
- Instead of: if (window.event) {img = window.event.srcElement; } else {img = evt.target; // besides, where is var? globalki in fashion now? } Better: var img = evt? evt.
- And what is more beautiful? Lol - Zowie
- The author will never do so var img if AlexWindHope does not know that the variable declared inside a function with var is local! And global without var and outside of the function! I first read the books about JS then you will not fix it wrong! - Rules
|