Jump to content
  • 0

Изменение src картинки.


SuperPuperLesha
 Share

Question

4 answers to this question

Recommended Posts

  • 0

А в таком виде гляньте плиз

<html>
<body onload = "showtime();">


LONDON
<br><img id='l1' /> <img id='l2' /> <img src='clock/img/dgc.gif'/> <img id='l3' /> <img id='l4' />


<script language="JavaScript">
var Date_London = new Date(1238585593000);

function showtime()
{
Date_London.setTime(Date_London.getTime() + 1000);

var hours = Date_London.getHours()
var minutes = Date_London.getMinutes()
timeH = ((hours < 10) ? "0" : "") + hours
timeM = ((minutes < 10) ? "0" : "") + minutes
document.getElementById("l1").src=GetImgsrcFromInt(timeH[0]);
document.getElementById("l2").src=GetImgsrcFromInt(timeH[1]);
document.getElementById("l3").src=GetImgsrcFromInt(timeM[0]);
document.getElementById("l4").src=GetImgsrcFromInt(timeM[1]);

setTimeout("showtime()",1000)
}

function GetImgsrcFromInt(MInt)
{
RES = "clock/img/dg0.gif";
if(MInt=="0"){RES="clock/img/dg0.gif"}
if(MInt=="1"){RES="clock/img/dg1.gif"}
if(MInt=="2"){RES="clock/img/dg2.gif"}
if(MInt=="3"){RES="clock/img/dg3.gif"}
if(MInt=="4"){RES="clock/img/dg4.gif"}
if(MInt=="5"){RES="clock/img/dg5.gif"}
if(MInt=="6"){RES="clock/img/dg6.gif"}
if(MInt=="7"){RES="clock/img/dg7.gif"}
if(MInt=="8"){RES="clock/img/dg8.gif"}
if(MInt=="9"){RES="clock/img/dg9.gif"}

return RES;
}

</script>

</body>
</html>

Link to comment
Share on other sites

  • 0
<html>
<body onload = "showtime();">


LONDON
<br><img id='l1' /> <img id='l2' /> <img src='clock/img/dgc.gif'/> <img id='l3' /> <img id='l4' />


<script language="JavaScript">
var Date_London = new Date(1238585593000);

function showtime() {
Date_London.setTime(Date_London.getTime() + 1000);
var h = Date_London.getHours();
var m = Date_London.getMinutes();
timeH = ((h < 10) ? "0" : "") + h;
timeM = ((m < 10) ? "0" : "") + m;
document.getElementById("l1").src=GetImgsrcFromInt(timeH.charAt(0));
document.getElementById("l2").src=GetImgsrcFromInt(timeH.charAt(1));
document.getElementById("l3").src=GetImgsrcFromInt(timeM.charAt(0));
document.getElementById("l4").src=GetImgsrcFromInt(timeM.charAt(1));

setTimeout("showtime()",1000)
}

function GetImgsrcFromInt(MInt){ return "clock/img/dg"+MInt+".gif"}
</script>

</body>
</html>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy