Frame work
I'm copying the code of Activity 2 Replace the images and GIFs with new ones also the function also after enabling the third and fourth functions, the pictures from the first and second function should be disabled (should not be displayed). The images displayed by the placing function should disappear after the connect function is enabled.
`
Bulb without switchActivity 2 : To glow a bulb
You only need three things to perform this activity...
- Battery
- Bulb
- Wires
<div class="buttons">
<br>
<br>
<img src="D:\html\internship22\batteryconnected.jpg" align="right" style="display:none;" id="batterycon" >
<img src="D:\html\internship22\batteryplaced.jpg" align="right" style="display: none;" id="batteryplac">
<img src="D:\html\internship22\bulbplaced.jpg" align="right" style="display: none;" id="bulbplac">
<img src="D:\html\internship22\bulbconnected.jpg" align="right" style="display: none;" id="bulbcon">
<button onclick="PlaceBulb()">1. CLICK TO PLACE BULB</button>
<br>
<br>
<button onclick="PlaceBattery()">2.CLICK TO PLACE BATTERY</button>
<br>
<br>
<button onclick="BulbConnect()">3.CLICK TO CONNECT WIRES TO BULB</button>
<br>
<br>
<button onclick="ConnectBatteryBulb()">4.CLICK TO CONNECT BATTERY WITH BULB</button>
</div>
<br>
<hr>
<br>
<script type="text/javascript">
function PlaceBulb()
{
display_image('bulbplaced.jpg', 100, 100, 'JavaScriptImage');
}
function PlaceBattery(){
display_image('batteryplaced.jpg',100,100,'batteryimg');
}
function BulbConnect()
{ display_image('bulbconnected.jpg',100,100,'bulb connected');
document.getElementById("bulbplac").style.display='none';
}
function ConnectBatteryBulb()
{ display_image('circuitgif.gif',200,200,'working');
}
function display_image(src, width, height, alt)
{
var a = document.createElement("img");
a.src = src;
a.width = width;
a.height = height;
a.alt = alt;
document.body.appendChild(a);
//this function is still not tested function removeElement(ele) { ele.parentNode.removeChild(ele); }
removeElement(document.getElementById("image_X"));
`Edited by LS MADHURIMA