Click to See Complete Forum and Search --> : Executing Javascript manually - Possible?


amoghul
12-30-2002, 12:21 PM
Hi all

I havent used Javascript before and im new to this forum too.

Basically I want to achieve the following:

On a website, after I perform a search, the search splits the results into several pages. To advance to the next set of results, the user can press an icon which advances to the next set of results.

When hovering over this button, the script displays "Javascript:toPage('2')"

Instead of pressing the little arrow ffor "next page" each time - I just want to be able to execute some script that will execute the "Javascript:toPage('2')" pause for a few seconds and then execute Javascript:toPage('3') etc.

Is it possible to write something which will do this (assuming I find out how many pages I need to advance) Answers not relating to javascript also welcome.


Thanks for all answers

AdamBrill
12-30-2002, 12:51 PM
Try using setTimeout like this:



<script language=javascript>
setTimeout("toPage('1')",3000);
</script>


Just change the 3000 to however long you want it to wait(in milliseconds). That should work for you.

khalidali63
12-30-2002, 01:06 PM
in addition to the above,you may find thios usefull,since you said you were new 2 JS

here is the above solution with a bit of more detail



code:
<script language=javascript>

setTimeout("toPage('1')",3000);

function toPage(url){
location.href = url;
//where url should point to the next //pages address i.e //searchResultPage2.html
}
</script>

Khalid

amoghul
12-30-2002, 01:19 PM
Hi

In additon to my original question, I should add the following points:

1. The website I am accessing is something i dont have the source for. It is not written by myself.

2. When I click the 'Next' Icon, the URL is not displayed (otherwise I can do the solution in VB :) )

I think as an example I will post this URL
http://www.savastore.com/products/ssearch.asp?search=list&Step=keep&Str=MAIN&salcat=MONI&prodline=17MN

if you place the mouse on the >>> icon, you will see it actually goes to Javascript:toPage('2').

I want to be able to scroll through all these pages, pausing after each for a few seconds.


Thanks again for responses

AdamBrill
12-30-2002, 01:41 PM
I see what you mean, but you can't do anything if you can't edit the code. The only way that I can think of is by adding a frame on the top with the width at like 1 pixel. Then, have that page change the other page every couple seconds. Hope that helps...

khalidali63
12-30-2002, 01:49 PM
Yes,
though javascript is the one thats forwarding to the next page its the serverside VB code that is determining which page to forward to.

as mentioned in the possible solution above,even then you have to forward the request to the server with appropriate flag

FYI
take alook at this function in the url you provided

function toPage(numPage){
document.SavaStore.numPage.value=numPage;
document.SavaStore.action='/products/ssearch.asp?searchtype=list&tid=';
document.SavaStore.submit();
}

Khalid