Created
April 2, 2012 21:04
-
-
Save h4/2287186 to your computer and use it in GitHub Desktop.
Объект image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.write("Всего: " + document.images.length + " шт. рисунков."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.write("Всего: " + document.images.length + " шт. рисунков."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Замена изображения</title> | |
<script> | |
window.onload = setEvents; | |
function setEvents() { | |
var doodle = document.getElementById("doodle"); | |
doodle.onmouseover = mouseOver; | |
doodle.onmouseout = mouseOut; | |
} | |
function mouseOver() { | |
doodle.src ="http://www.google.com/logos/2012/steno12-hp.jpg"; | |
} | |
function mouseOut() { | |
doodle.src ="http://www.google.com/logos/2012/serbia12-hp.jpg"; | |
} | |
</script> | |
</head> | |
<body> | |
<img src="http://www.google.com/logos/2012/stpatricksday11-hp.jpg" alt="Дудл" id="doodle"> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Динамическое создание изображений</title> | |
<script> | |
var button1up = new Image, | |
button1down = new Image; | |
button1up.src = "http://www.google.com/logos/2012/serbia12-hp.jpg"; | |
button1down.src = "http://www.google.com/logos/2012/steno12-hp.jpg"; | |
function MouseOverRoutine(ButtonName) { | |
if (ButtonName == "button1") { | |
document.button1.src = button1down.src;} | |
} | |
function MouseOutRoutine(ButtonName) { | |
if (ButtonName == "button1") { | |
document.button1.src = button1up.src; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<a href="#" onmouseover="MouseOverRoutine('button1')" onmouseout="MouseOutRoutine('button1')"> | |
<img src="http://www.google.com/logos/2012/serbia12-hp.jpg" name="button1" /> | |
</a> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Рисунки</title> | |
<script> | |
var imgArr, | |
imgLen; | |
function preload (url) { | |
if (!imgArr) { | |
imgArr = []; | |
imgLen = 0; | |
} | |
imgArr[imgLen] = new Image(); | |
imgArr[imgLen].src = url; | |
imgLen++; | |
} | |
function changeImg(x, y) { | |
var temp; | |
temp = imgArr[x].src; | |
imgArr[x].src = document.images[y].src; | |
document.images[y].src = temp; | |
} | |
preload('http://www.google.com/logos/2012/steno12-hp.jpg'); | |
</script> | |
</head> | |
<body> | |
<a href="#" onMouseOver="ChImg(0, 0)" onMouseOut="changeImg(0, 0)"> | |
<img src="http://www.google.com/logos/2012/serbia12-hp.jpg"> | |
</a> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img name="animation" src="images/0.gif"> | |
<script> | |
var aniframes = new Array(10), | |
frame = 0, | |
timeout_id = null; | |
for (var i = 0; i < 10; i++) { | |
aniframes[i] = new Image(); | |
aniframes[i].src = "images/" + i + ".gif"; | |
} | |
function animate() { | |
document.animation.src = aniframes[frame].src; | |
frame = (frame + 1) % 10; | |
timeout_id = setTimeout("animate()", 250); | |
} | |
</script> | |
<form> | |
<input type="button" value="Start" | |
onclick="if(timeout_id == null) animate();"> | |
<input type="button" value="Stop" | |
onclick="if (timeout_id) clearTimeout(timeout_id);timeout_id=null;"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment