开发者

incrementing a value after each refresh in javascript

I'm developing a web application in asp.net c#, which has a URL like this...

http://localhost:1096/DisplayPop3Email.aspx?emailId=10

After a given time, I want to refresh the page, increasing the value of emailId. This is a repeating process that should happen after a certain amount of time has passed.

After the first refresh, the URL should now look like this...

http://localhost:1096/DisplayPop3Email.aspx?emailId=11
开发者_如何学JAVA

I have written a javascript function to refresh the page after a fixed time, but how can i increase the value of emailid after each refresh?

This is my Javascript code...

<script type="text/javascript">
    var sURL = unescape(window.location.pathname);

    function doLoad(){
        setTimeout("refresh()", 2*15000 );
    }

    function refresh(){
        window.location.href = sURL;
    }
</script>

<script type="text/javascript">
    function refresh() {
        window.location.replace( sURL );
    }
</script>

I call doload() from inside another Javascript function, as per below...

<script type="text/javascript">
    function openNewWindow(spcd,cval) {
        var tt = spcd;
        var testarray=(spcd).split('@%@');

        for(i=0;i<testarray.length-1;i++) {
            var theurl=testarray[i];

            if(theurl=="http://www.colbridge.com"){
                popupWin = window.open(theurl,'_blank','menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0')
                break;
            }
        }

        receiveval(cval);
        doLoad();
    }
</script>

I call openNewWindow(spcd) inside my asp.net page_load event.

Could someone please help me to identify how to increment the counter after each refresh.


Call the function below:

function goToNextId() {
  var id = 1 + parseInt(window.location.href.match(/emailId=(\d+)/)[1]);
  window.location.href = window.location.href.replace(/emailId=(\d+)/, "emailId=" + id);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜