WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1JavaScript & ...HTML? Help Empty JavaScript & ...HTML? Help Thu Jan 14, 2010 9:29 pm

MrMega

MrMega
Registered Member
Registered Member
Code:

<div align="center">
<script type="text/javascript">
function show_alert()
{
alert("You opened the Golden Treasure Chest and found...nothing but dust");
}
</script>
<img id="Secret" src="http://stupidmariobrosfansite.freeforums.org/images/Treasure-chest-closed-icon.gif" width="32" height="32" border="0" alt="" / onclick="show_alert()" value="Show alert box" />


How do I make the code after the div align appear only at certain times of the day, via JavaScript code? (automatically)



Last edited by MrMega on Mon Jan 18, 2010 4:17 am; edited 4 times in total

2JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Thu Jan 14, 2010 10:03 pm

Sanket

Sanket
Administrator
Administrator
I too am not fully aware of javascript working.

http://javascript.about.com/library/blrand.htm

Check that out. This could help.

http://www.webartzforum.com

3JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Thu Jan 14, 2010 10:23 pm

MrMega

MrMega
Registered Member
Registered Member
Umm...sorry, that doesn't really work. What I mean is like a code to choose exactly what time the code should appear to a user.

4JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Sun Jan 17, 2010 9:56 pm

ankillien

ankillien
Administrator
Administrator
So, what exactly you want is to get the code executed on a particular time of a day, right?
At whats time you want the function to execute?

5JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Sun Jan 17, 2010 11:24 pm

MrMega

MrMega
Registered Member
Registered Member
Every hour; 12:00, 1:00, 2:00, etc

But only for the exact minute of that hour. SO when it turns like, for example, 1:01 PM, the code disappears.

6JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Sun Jan 17, 2010 11:41 pm

ankillien

ankillien
Administrator
Administrator
Ok, I'll try to write a code for that Smile

7JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Thu Jan 21, 2010 9:25 pm

ankillien

ankillien
Administrator
Administrator
Ok, I wrote something like this...

Code:
<html>
<head>
<title>popAtTime</title>
</head>
<script>
<!-- Begin
x = window.setInterval("checkTime('10:56')")

function checkTime(x){
  t = new Date()
  h = t.getHours()
  m = t.getMinutes()
  time = h+":"+m
  if(x == time) alert("You opened the Golden Treasure Chest and found...nothing but dust")
  return true;
}

// End -->
</script>
<body onload="checkTime(x)">
blah............blah..............

</body>
</html>

You can set the time on this line when you want the popup to show...

x = window.setInterval("checkTime('10:56')")

8JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Fri Jan 22, 2010 4:51 am

MrMega

MrMega
Registered Member
Registered Member
what about the image? i kind of need the image to make the full code work.

but thanks a bunch Very Happy

9JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Mon Jan 25, 2010 9:35 pm

ankillien

ankillien
Administrator
Administrator
Ok, I wrote a script.
Sorry for delay. It takes much time as I am not very good at using JavaScript's time and date functions Razz

Code:
<script>
<!-- Begin

t = new Date()
h = t.getHours()
m = t.getMinutes()

function boom() {
document.write('<img src="IMAGE URL HERE">')
alert('You opened the Golden Treasure Chest and found...nothing but dust!')
}
if (h==19 && m==59) {
boom()
}

// End -->
</script>

Set the time in this line...
if (h==19 && m==59) {

h = hours and m= minutes Very Happy
Don't forget to put your image URL in this line...
document.write('<img src="IMAGE URL HERE">')

Hope that helps.

10JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Tue Jan 26, 2010 8:15 am

MrMega

MrMega
Registered Member
Registered Member
Thank you Smile

11JavaScript & ...HTML? Help Empty Re: JavaScript & ...HTML? Help Tue Jan 26, 2010 10:16 am

ankillien

ankillien
Administrator
Administrator
No problem mate.

Locked

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum