the images are not toggling on the button clickCode:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> <script type="text/javascript" language="javascript"> function toggle() { if(document.getElementById('img1').src=="img/Autumn Leaves.jpg") { document.getElementById('img1').src="img/Creek.jpg"; setTimeout ( "setAnotherImage()", 2000 ); } } function setAnotherImage() { if(document.getElementById('img1').src=="img/Creek.jpg") { document.getElementById('img1').src="img/Autumn Leaves.jpg"; setTimeout ( "toggle()", 2000 ); } } </script> </head> <body > <form id="form1" runat="server"> <div> <img id="img1" src="img/Autumn Leaves.jpg" alt="Image cannot be displayed" height="400" width="400"/> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="toggle()" /> </div> </form> </body> </html>
please help





Reply With Quote