/    Sign up×
Community /Pin to ProfileBookmark

Executing Javascript manually – Possible?

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

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@AdamBrillDec 30.2002 — Try using setTimeout like this:


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


Just change the 3000 to however long you want it to wait(in milliseconds). That should work for you.
Copy linkTweet thisAlerts:
@khalidali63Dec 30.2002 — 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
Copy linkTweet thisAlerts:
@amoghulauthorDec 30.2002 — 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
    Copy linkTweet thisAlerts:
    @AdamBrillDec 30.2002 — 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...
    Copy linkTweet thisAlerts:
    @khalidali63Dec 30.2002 — 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
    ×

    Success!

    Help @amoghul spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.8,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...