<!DOCTYPE html> <html> <head> <style> div { width: 400px; height: 400px; border: 1px solid black; } </style> <script> function ChangeImage(param) { switch(param) { case '1': return("http://localhost/tlushim/images/greensilver.gif"); break; case'2': return("http://localhost/tlushim/images/greensilver1.gif"); break; } } </script> </head> <body> <div id="myDiv"></div> <script> document.getElementById("myDiv").style.backgroundImage = "url(ChangeImage('1'))"; </script> </body> </html>
|