Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set time out help

Status
Not open for further replies.

marianmarian

Programmer
Jan 17, 2003
40
0
0
CA
here is what i am doing.

in my html file i have these:

<script>
setTimeout('downloadEnv(someDate)',5000);
function downloadEnv(created)
{
document.location="download.php?date=" + created;
}
</script>

<html>

<td>
<a href="download.php" onclick="JavaScript:someDate.value='2004';">Download</a>
</td
</html>

how do i get my settimeout to get the value of 2004?
 
This page changes the source of the page in 5 seconds, regardless of user input. Is that what you want?
That said,
Code:
<script>
var someDate = '2000'; // Default date
setTimeout('downloadEnv()',5000);
function downloadEnv()
{
    document.location="download.php?date=" + someDate; // get global variable
}
</script>

<html>

<td>    
    <a href="download.php" onclick="someDate='2004';">Download</a>
    </td>
</html>

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
yes with the exception that i want someDate's value to be the onclick="someDate.value='whatever i assigned it to'".

ok so will var someDate's value be 'whatever i assigned it to'?

thanks
 
ok i changed my code around to use forms but i am still unable to get the values:

<form action="download.php" name="myForm">
<input type="hidden" value="$dateCreatedNotFormated" name="date">
<input type="hidden" value="letter" name="format">
<input type="hidden" value="" name="someDate">
<input type="submit" value="Download" onclick="JavaScript:myForm.someDate.value='2004';">
</form>

<script>
setTimeout('downloadEnv(document.myForm.someDate.value)',5000);
function downloadEnv(created)
{
document.location="download.php?date=" + created;
}
</script>
 
Question on a higher level: Do you want to load the new page 5 seconds after the page is loaded, or do you want to load it 5 seconds after the link (or button) is clicked?

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
I want to load it 5 seconds after the link (or button) is clicked?

thanks
 
All right.
From where are you obtaining the variable to append to the url?

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
i was able to do this with javascript settimeout; very easy; here is what i did:


i had a form:

<form action="download.php" name="myForm">
<input type="hidden" value="envelope" name="aFormat">
<input type="hidden" value="" name="aDate">
</form>

and this where the trick was:

<td>
<a href="download.php?format=letter&date=2004" onclick="JavaScript:myForm.aDate.value='2004'; setTimeout('document.myForm.submit()',15000);">Download</a>
</td

so with this i was able to a multiple downloads, the first click download the first file, and after the 15000 timeout, the second download occurs.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top