473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

possible java script question

Hi I have a .net application that shows the start page for a few seconds and
then goes to another start page. I was wondering if it would be possible to
put a count on the page to let the user know how much time is left before it
goes to the other page, thanks.
--
Paul G
Software engineer.
Jan 5 '06 #1
13 1640
How are you redirecting to the second page?

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
Hi I have a .net application that shows the start page for a few seconds
and
then goes to another start page. I was wondering if it would be possible
to
put a count on the page to let the user know how much time is left before
it
goes to the other page, thanks.
--
Paul G
Software engineer.

Jan 5 '06 #2
Hi thanks for the response, I am using the meta tag as follows to redirect.
<meta http-equiv="refresh"
content="4;url=http://localhost/JT3TeamPortal/index.aspx">
--
Paul G
Software engineer.
"Peter Rilling" wrote:
How are you redirecting to the second page?

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
Hi I have a .net application that shows the start page for a few seconds
and
then goes to another start page. I was wondering if it would be possible
to
put a count on the page to let the user know how much time is left before
it
goes to the other page, thanks.
--
Paul G
Software engineer.


Jan 5 '06 #3
<input type="text" size="10" id="timer" value="60">
<input type="text" size="5" id="timer" value="60" style="font-size: 14pt"
name="timer">
<script type="text/javascript"><!--
var timeLeft = 60;
function setTimer()
{
if (timeLeft > 0) timeLeft--;
document.getElementById("timer").value = timeLeft;
}
setInterval("setTimer()", 1000);
//--></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
Hi I have a .net application that shows the start page for a few seconds
and
then goes to another start page. I was wondering if it would be possible
to
put a count on the page to let the user know how much time is left before
it
goes to the other page, thanks.
--
Paul G
Software engineer.

Jan 5 '06 #4
Write to the web page using a JavaScript function that is invoked every
second (using the setInterval), like this:

<script language="javascript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("WriteCount()",100);//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getElementById("RemainingSeconds");
DisplayBox.innerText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInterval(iIntervalID);
}

}

</script>
</head>
<body onload="StartCounter()">
<div id="RemainingSeconds" style="font-size:16pt;color:black;border:1pt gray
solid;width:200pt;background-color:lightsteelblue;"/>
</body>

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Paul" wrote:
Hi I have a .net application that shows the start page for a few seconds and
then goes to another start page. I was wondering if it would be possible to
put a count on the page to let the user know how much time is left before it
goes to the other page, thanks.
--
Paul G
Software engineer.

Jan 5 '06 #5
To expand on everyone else's solutions for doing a countdown, I would
suggest that you have JavaScript redirect when the timer reaches zero. If
you use the meta refresh, then that may be out of synch with the JS timer
variable and may not be exact. Just a thought.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
Hi I have a .net application that shows the start page for a few seconds
and
then goes to another start page. I was wondering if it would be possible
to
put a count on the page to let the user know how much time is left before
it
goes to the other page, thanks.
--
Paul G
Software engineer.

Jan 5 '06 #6
Hi thanks I tried it but get the following error,
per the active schema the element input can not be nested within "head"
--
Paul G
Software engineer.
"Kevin Spencer" wrote:
<input type="text" size="10" id="timer" value="60">
<input type="text" size="5" id="timer" value="60" style="font-size: 14pt"
name="timer">
<script type="text/javascript"><!--
var timeLeft = 60;
function setTimer()
{
if (timeLeft > 0) timeLeft--;
document.getElementById("timer").value = timeLeft;
}
setInterval("setTimer()", 1000);
//--></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
Hi I have a .net application that shows the start page for a few seconds
and
then goes to another start page. I was wondering if it would be possible
to
put a count on the page to let the user know how much time is left before
it
goes to the other page, thanks.
--
Paul G
Software engineer.


Jan 5 '06 #7
Hi thanks for the response, I was able to add the script but the count did
not seemed to showup on the page.
--
Paul G
Software engineer.
"Phillip Williams" wrote:
Write to the web page using a JavaScript function that is invoked every
second (using the setInterval), like this:

<script language="javascript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("WriteCount()",100);//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getElementById("RemainingSeconds");
DisplayBox.innerText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInterval(iIntervalID);
}

}

</script>
</head>
<body onload="StartCounter()">
<div id="RemainingSeconds" style="font-size:16pt;color:black;border:1pt gray
solid;width:200pt;background-color:lightsteelblue;"/>
</body>

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Paul" wrote:
Hi I have a .net application that shows the start page for a few seconds and
then goes to another start page. I was wondering if it would be possible to
put a count on the page to let the user know how much time is left before it
goes to the other page, thanks.
--
Paul G
Software engineer.

Jan 5 '06 #8
Hi Paul,

You might have to check for syntax mistakes in specifying the id of the
object that displays the message on your page.

This is the complete HTML file of the code I posted earlier. If you save it
and browse it, it should work fine.

<html>
<head>
<script language="javascript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("WriteCount()",100);//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getElementById("RemainingSeconds");
DisplayBox.innerText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInterval(iIntervalID);
}

}

</script>
</head>
<body onload="StartCounter()">
<div id="RemainingSeconds" style="font-size:16pt;color:black;border:1pt gray
solid;width:200pt;background-color:lightsteelblue;"/>
</body>
</html>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Paul" wrote:
Hi thanks for the response, I was able to add the script but the count did
not seemed to showup on the page.
--
Paul G
Software engineer.
"Phillip Williams" wrote:
Write to the web page using a JavaScript function that is invoked every
second (using the setInterval), like this:

<script language="javascript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("WriteCount()",100);//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getElementById("RemainingSeconds");
DisplayBox.innerText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInterval(iIntervalID);
}

}

</script>
</head>
<body onload="StartCounter()">
<div id="RemainingSeconds" style="font-size:16pt;color:black;border:1pt gray
solid;width:200pt;background-color:lightsteelblue;"/>
</body>

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Paul" wrote:
Hi I have a .net application that shows the start page for a few seconds and
then goes to another start page. I was wondering if it would be possible to
put a count on the page to let the user know how much time is left before it
goes to the other page, thanks.
--
Paul G
Software engineer.

Jan 5 '06 #9
Hi Paul,

The text box was an example of displaying the data. The data is the variable
"timeLeft." The function decrements the variable and displays it (in this
case) in a text box. How you display the value of the variable is up to you.
In other words, I didn't intend for you to simply copy and paste it.
Apparently, you pasted it into the <head> section of your document. I'm not
sure why. In any case, an "input type=text" text box belongs inside a form.
A script can be anywhere in an HTML document.

Just use that Software engineer inside you to take my example, and create
your own implementation of it, based upon the principles illustrated, and of
course, obeying the rules of HTML.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
Hi thanks I tried it but get the following error,
per the active schema the element input can not be nested within "head"
--
Paul G
Software engineer.
"Kevin Spencer" wrote:
<input type="text" size="10" id="timer" value="60">
<input type="text" size="5" id="timer" value="60" style="font-size: 14pt"
name="timer">
<script type="text/javascript"><!--
var timeLeft = 60;
function setTimer()
{
if (timeLeft > 0) timeLeft--;
document.getElementById("timer").value = timeLeft;
}
setInterval("setTimer()", 1000);
//--></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
> Hi I have a .net application that shows the start page for a few
> seconds
> and
> then goes to another start page. I was wondering if it would be
> possible
> to
> put a count on the page to let the user know how much time is left
> before
> it
> goes to the other page, thanks.
> --
> Paul G
> Software engineer.


Jan 5 '06 #10
ok thanks,just tried to copy it without reading through it.
--
Paul G
Software engineer.
"Kevin Spencer" wrote:
Hi Paul,

The text box was an example of displaying the data. The data is the variable
"timeLeft." The function decrements the variable and displays it (in this
case) in a text box. How you display the value of the variable is up to you.
In other words, I didn't intend for you to simply copy and paste it.
Apparently, you pasted it into the <head> section of your document. I'm not
sure why. In any case, an "input type=text" text box belongs inside a form.
A script can be anywhere in an HTML document.

Just use that Software engineer inside you to take my example, and create
your own implementation of it, based upon the principles illustrated, and of
course, obeying the rules of HTML.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
Hi thanks I tried it but get the following error,
per the active schema the element input can not be nested within "head"
--
Paul G
Software engineer.
"Kevin Spencer" wrote:
<input type="text" size="10" id="timer" value="60">
<input type="text" size="5" id="timer" value="60" style="font-size: 14pt"
name="timer">
<script type="text/javascript"><!--
var timeLeft = 60;
function setTimer()
{
if (timeLeft > 0) timeLeft--;
document.getElementById("timer").value = timeLeft;
}
setInterval("setTimer()", 1000);
//--></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
> Hi I have a .net application that shows the start page for a few
> seconds
> and
> then goes to another start page. I was wondering if it would be
> possible
> to
> put a count on the page to let the user know how much time is left
> before
> it
> goes to the other page, thanks.
> --
> Paul G
> Software engineer.


Jan 5 '06 #11
ok thanks will take a closer look at it.
--
Paul G
Software engineer.
"Phillip Williams" wrote:
Hi Paul,

You might have to check for syntax mistakes in specifying the id of the
object that displays the message on your page.

This is the complete HTML file of the code I posted earlier. If you save it
and browse it, it should work fine.

<html>
<head>
<script language="javascript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("WriteCount()",100);//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getElementById("RemainingSeconds");
DisplayBox.innerText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInterval(iIntervalID);
}

}

</script>
</head>
<body onload="StartCounter()">
<div id="RemainingSeconds" style="font-size:16pt;color:black;border:1pt gray
solid;width:200pt;background-color:lightsteelblue;"/>
</body>
</html>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Paul" wrote:
Hi thanks for the response, I was able to add the script but the count did
not seemed to showup on the page.
--
Paul G
Software engineer.
"Phillip Williams" wrote:
Write to the web page using a JavaScript function that is invoked every
second (using the setInterval), like this:

<script language="javascript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("WriteCount()",100);//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getElementById("RemainingSeconds");
DisplayBox.innerText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInterval(iIntervalID);
}

}

</script>
</head>
<body onload="StartCounter()">
<div id="RemainingSeconds" style="font-size:16pt;color:black;border:1pt gray
solid;width:200pt;background-color:lightsteelblue;"/>
</body>

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Paul" wrote:

> Hi I have a .net application that shows the start page for a few seconds and
> then goes to another start page. I was wondering if it would be possible to
> put a count on the page to let the user know how much time is left before it
> goes to the other page, thanks.
> --
> Paul G
> Software engineer.

Jan 5 '06 #12
ok got it working!
--
Paul G
Software engineer.
"Kevin Spencer" wrote:
Hi Paul,

The text box was an example of displaying the data. The data is the variable
"timeLeft." The function decrements the variable and displays it (in this
case) in a text box. How you display the value of the variable is up to you.
In other words, I didn't intend for you to simply copy and paste it.
Apparently, you pasted it into the <head> section of your document. I'm not
sure why. In any case, an "input type=text" text box belongs inside a form.
A script can be anywhere in an HTML document.

Just use that Software engineer inside you to take my example, and create
your own implementation of it, based upon the principles illustrated, and of
course, obeying the rules of HTML.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
Hi thanks I tried it but get the following error,
per the active schema the element input can not be nested within "head"
--
Paul G
Software engineer.
"Kevin Spencer" wrote:
<input type="text" size="10" id="timer" value="60">
<input type="text" size="5" id="timer" value="60" style="font-size: 14pt"
name="timer">
<script type="text/javascript"><!--
var timeLeft = 60;
function setTimer()
{
if (timeLeft > 0) timeLeft--;
document.getElementById("timer").value = timeLeft;
}
setInterval("setTimer()", 1000);
//--></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
> Hi I have a .net application that shows the start page for a few
> seconds
> and
> then goes to another start page. I was wondering if it would be
> possible
> to
> put a count on the page to let the user know how much time is left
> before
> it
> goes to the other page, thanks.
> --
> Paul G
> Software engineer.


Jan 5 '06 #13
> ok got it working!

:-D

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:A7**********************************@microsof t.com...
ok got it working!
--
Paul G
Software engineer.
"Kevin Spencer" wrote:
Hi Paul,

The text box was an example of displaying the data. The data is the
variable
"timeLeft." The function decrements the variable and displays it (in this
case) in a text box. How you display the value of the variable is up to
you.
In other words, I didn't intend for you to simply copy and paste it.
Apparently, you pasted it into the <head> section of your document. I'm
not
sure why. In any case, an "input type=text" text box belongs inside a
form.
A script can be anywhere in an HTML document.

Just use that Software engineer inside you to take my example, and create
your own implementation of it, based upon the principles illustrated, and
of
course, obeying the rules of HTML.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
> Hi thanks I tried it but get the following error,
> per the active schema the element input can not be nested within "head"
> --
> Paul G
> Software engineer.
>
>
> "Kevin Spencer" wrote:
>
>> <input type="text" size="10" id="timer" value="60">
>> <input type="text" size="5" id="timer" value="60" style="font-size:
>> 14pt"
>> name="timer">
>> <script type="text/javascript"><!--
>> var timeLeft = 60;
>> function setTimer()
>> {
>> if (timeLeft > 0) timeLeft--;
>> document.getElementById("timer").value = timeLeft;
>> }
>> setInterval("setTimer()", 1000);
>> //--></script>
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> You can lead a fish to a bicycle,
>> but it takes a very long time,
>> and the bicycle has to *want* to change.
>>
>> "Paul" <Pa**@discussions.microsoft.com> wrote in message
>> news:1D**********************************@microsof t.com...
>> > Hi I have a .net application that shows the start page for a few
>> > seconds
>> > and
>> > then goes to another start page. I was wondering if it would be
>> > possible
>> > to
>> > put a count on the page to let the user know how much time is left
>> > before
>> > it
>> > goes to the other page, thanks.
>> > --
>> > Paul G
>> > Software engineer.
>>
>>
>>


Jan 5 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: StealthMonkey | last post by:
Let me prefix this by saying that I know next to nothing about Java (so please try to keep explainations simple). I use PHP for my server-side web programming. Here is my dilemma: I need a...
1
by: GG | last post by:
Hi all, This is not necessarily an Ant question, nor a standard sun Javac. I am using both, and all suggestions are welcome. I would like to build as many classes as possible from a given...
6
by: S P Arif Sahari Wibowo | last post by:
Hi! I am thinking to have a client-side script doing processing on file downloading, basically the script will process a downloaded file from the server before it received by the user. For...
8
by: dbaplusplus | last post by:
I worked on web development using java script many many years, so I am now a newbie to javascript. I have a single html page, which is generated dynamically using some programming language. Web...
8
by: GS | last post by:
Guys: I have a question, Is it possible to implement pop-up window without Java script, we don't want to use java script since it might get blocked by pop-up blocker. Thanks in advance. GS.
40
by: navti | last post by:
I saw here http://java.sun.com/javase/6/docs/technotes/tools/share/jsdocs/index.html that javascript has built-in methods such as cp, dir, date etc how do i get these to run on the client...
14
by: DavidNorep | last post by:
I do not know PHP, consider to write a CGI with this technology and have the following question. Is it possible to invoke a PHP script and let it endlessly wait for requests from a website (a...
5
by: Ankur | last post by:
Hi Folks, I am new for this group. I want to clarify one thing what's a basic difference between Client Side Java Script and Server Side Java Script. how we can differentiate it. Why we called...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.