473,568 Members | 2,923 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1652
How are you redirecting to the second page?

"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message
news:1D******** *************** ***********@mic rosoft.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**@discussio ns.microsoft.co m> wrote in message
news:1D******** *************** ***********@mic rosoft.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.getEle mentById("timer ").value = timeLeft;
}
setInterval("se tTimer()", 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**@discussio ns.microsoft.co m> wrote in message
news:1D******** *************** ***********@mic rosoft.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="javas cript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("Wr iteCount()",100 );//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getEle mentById("Remai ningSeconds");
DisplayBox.inne rText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInt erval(iInterval ID);
}

}

</script>
</head>
<body onload="StartCo unter()">
<div id="RemainingSe conds" style="font-size:16pt;color :black;border:1 pt gray
solid;width:200 pt;background-color:lightstee lblue;"/>
</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**@discussio ns.microsoft.co m> wrote in message
news:1D******** *************** ***********@mic rosoft.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.getEle mentById("timer ").value = timeLeft;
}
setInterval("se tTimer()", 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**@discussio ns.microsoft.co m> wrote in message
news:1D******** *************** ***********@mic rosoft.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="javas cript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("Wr iteCount()",100 );//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getEle mentById("Remai ningSeconds");
DisplayBox.inne rText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInt erval(iInterval ID);
}

}

</script>
</head>
<body onload="StartCo unter()">
<div id="RemainingSe conds" style="font-size:16pt;color :black;border:1 pt gray
solid;width:200 pt;background-color:lightstee lblue;"/>
</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="javas cript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("Wr iteCount()",100 );//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getEle mentById("Remai ningSeconds");
DisplayBox.inne rText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInt erval(iInterval ID);
}

}

</script>
</head>
<body onload="StartCo unter()">
<div id="RemainingSe conds" style="font-size:16pt;color :black;border:1 pt gray
solid;width:200 pt;background-color:lightstee lblue;"/>
</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="javas cript">
var iSeconds =30; //wait for 30 seconds
var iIntervalID = null;
function StartCounter()
{
iIntervalID = setInterval("Wr iteCount()",100 );//writes the count every 1
second
}

function WriteCount(){

iSeconds--;
var DisplayBox = document.getEle mentById("Remai ningSeconds");
DisplayBox.inne rText="Time remaining: " + iSeconds;
if (iSeconds==0)
{
window.clearInt erval(iInterval ID);
}

}

</script>
</head>
<body onload="StartCo unter()">
<div id="RemainingSe conds" style="font-size:16pt;color :black;border:1 pt gray
solid;width:200 pt;background-color:lightstee lblue;"/>
</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**@discussio ns.microsoft.co m> wrote in message
news:32******** *************** ***********@mic rosoft.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.getEle mentById("timer ").value = timeLeft;
}
setInterval("se tTimer()", 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**@discussio ns.microsoft.co m> wrote in message
news:1D******** *************** ***********@mic rosoft.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

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

Similar topics

3
5168
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 JavaScript function to be called with a dynamic parameter, an ID# known by the server. The way I would go about doing this in PHP would be extremely...
1
3098
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 "project". In an Ant script, I just supply all classes from a given "project" (or "module" -- the idea is that the code base is divided into modules),...
6
1864
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 example, the weboage will have a link to download file A, but the one stored in the server is not exactly file A, but some transformation of it. If the...
8
2375
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 page will be viewed using Microsoft's IE browser (version 6.x ....). Webapge is self-contained. i.e., it does not refer to any links outside the...
8
1818
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
2824
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 computer ? the client will be linux or osx .
14
2024
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 Java applet in my case) and serve the requests when they arrive? I want to avoid loading the script for each request. In other words, can it...
5
13107
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 this kind of script "Server Side Java Script". I am in confusion because according to lots of web developer Java Script is a client side scripting...
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7660
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6275
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.