Idea behind this is to get all images of current webpage and change the picture shown with Javascript.
<html>
<head>
<title>Looping through IMG-tags example</title>
<script type="text/javascript">
function getImages()
{
var images = document.getElementsByTagName("IMG");
var numOfImages = images.length;
var origImage;
for(i=0;i<numOfImages;i++)
{
origImage = images[i].src;
images[i].src="http://www.google.com/ig/images/igoogle_logo_sm.gif";
images[i].alt="Original image used is " + origImage;
}
}
window.onload = getImages;
</script>
</head>
<body>
<img src="http://www.lo.fi/goo.gif" height="55" width="166">
<img src="http://www.lo.fi/gaa.gif" height="55" width="166">
</body>
</html>
Näytetään tekstit, joissa on tunniste html. Näytä kaikki tekstit
Näytetään tekstit, joissa on tunniste html. Näytä kaikki tekstit
keskiviikko 12. syyskuuta 2007
tiistai 4. syyskuuta 2007
Basic Confirm box with Javascript
// Basic Confirm box with Javascript
if (confirm("Do you want to continue?")) {
alert("Yes, you do!");
}
else {
alert("Nah, you don't..");
}
Paste this to external.js -file and call it from HTML page like this
<head>
<script language="javascript" type="text/javascript" src="external.js">
</script>
</head>
language="javascript" is not recommended anymore by W3C. Use only type="text/javascript".
if (confirm("Do you want to continue?")) {
alert("Yes, you do!");
}
else {
alert("Nah, you don't..");
}
Paste this to external.js -file and call it from HTML page like this
<head>
<script language="javascript" type="text/javascript" src="external.js">
</script>
</head>
language="javascript" is not recommended anymore by W3C. Use only type="text/javascript".
Tilaa:
Blogitekstit (Atom)