When I started learning JavaScript from zero, I used the w3schools website where I could easily compile the code without needing any IDE, etc... Now, I have moved on to using Visual Studio 2010 so I am gradually learning more and more.
In this example that turns a light bulb on and off, where is the bulb image stored on the w3schools website, so I can download and save it?
Now that I have a basic Visual Studio project (ASP.NET Web Application) that has a JavaScript and an HTML component, where should I store the bulb image and how should I reference it in my program?
my JavaScript code:
function changeImage()
{
var image = document.getElementById('myImage');
if ( image.src.match("bulbon") )
{
image.src = "pic_bulboff.gif";
}
else
{
image.src = "pic_bulbon.gif";
}
}
my HTML code:
<!DOCTYPE html PUBLIC>
<html>
<head>
<title>Title of the page</title>
<script type="text/javascript" src="JScript3.js"></script>
</head>
<body>
<h1>Header of the page</h1>
<p>Content of the page</p>
<p id = "demo">Click the light bulb to turn the light on & off</p>
<img id = "myImage"
onclick = "changeImage()"
src = "pic_bulboff.gif"
width="100" height="180">
</body>
</html>