HTML or Javascript Reload not Refresh

Hi there,
             i have been trying to refresh an ASP page without having the page Reload and scroll back to the top. I have a framed application and have been using a

<script>
function ReloadTasks()
{
parent.menc.location.href="tasks.asp"
}
</script>

to reload a page in a different frame. I have tried the parent.menc.location.reload(true) option but it does not work.

What i am trying to do is not have the page scroll back to the top as the reload occurs.

Can you help?

Neil
nlegaultAsked:
Who is Participating?
 
ZvonkoSystems architectCommented:
I can not open that upper link.
But never mind, I have a new idea for you.

You need no ReloadTasks() function to manage the frame menc window scroll position.
The frame menc has to manage its window position itself.
Like this:
<html>
<head>
<script>
function storePos(){
  document.cookie = "win_"+window.name+"="+document.body.scrollTop;
}
function lastPos(){
  cVal = document.cookie.split("win_"+window.name+"=");
  if(cVal.length==2){
    window.scrollTo(0,parseInt(cVal[1]));
  }
}
</script>
</head>
<body onLoad="lastPos()" onScroll="storePos()">

0
 
ZvonkoSystems architectCommented:
Only an idea:

<script>
function ReloadTasks(){
  sp = parent.menc.offsetTop;
  parent.menc.location.reload(true);
  parent.menc.scrollTo(0, sp);
}
</script>


0
 
nlegaultAuthor Commented:
This script did not work. The effect was the same.... Do you have another idea???

Neil
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
ZvonkoSystems architectCommented:
Sorry, that was not a tested idea.
Here a tested and working one:

<script>
function ReloadTasks(){
 sp = parent.menc.document.body.scrollTop;
 parent.menc.location.reload(true);
 setTimeout("parent.menc.scrollTo(0, "+sp+")", 100);
}
</script>


Increase the delay time if 100 miliseconds are to not enough.

0
 
Lord_McFlyCommented:
Why don'y you try a named Anchor...

<script>
function ReloadTasks()
{
parent.menc.location.href="tasks.asp#here"
}
</script>


In your HTML just above or around where you want the top of the page to be...

<a name="here"></a>
0
 
nlegaultAuthor Commented:
Hi Zvonko,
               funny behaviour....in my HTA app it does not work and in the web browser it brings me back to the top.... i really need it to only refersh and not scroll to top but stay exactly where it is...

Neil
0
 
ZvonkoSystems architectCommented:
In HTA you have to add to every <frame> definition this attribute:
<frame name=menc src=menc.htm APPLICATION=YES>
0
 
ZvonkoSystems architectCommented:
And it was working for me in IE and as HTA.
If you have problems, then you have typos :)
0
 
nlegaultAuthor Commented:
Hi Zvonko,

Still not working...I have in my frames page:
<frameset rows="25,*" cols="*" frameborder="yes" border="0" framespacing="0">
  <frame src="support/topc.htm" name="topc" scrolling="no" noresize >
  <frameset rows="*" cols="384,*" framespacing="0" frameborder="NO" border="0">
  <frameset rows="540,150" cols="1" frameborder="no">
    <frame src="support/tasks.asp" name="menc" scrolling="yes" APPLICATION=YES>
      <frame src="projc.htm" name="projc" scrolling="yes" APPLICATION=YES></frameset>
    <frame src="support/conc.htm" name="conc" scrolling="yes" APPLICATION=YES>
  </frameset>
</frameset>
<noframes>

In my content "conc" frame i have a details.asp page that has:

<script>
function ReloadTasks(){
 sp = parent.menc.document.body.scrollTop;
 parent.menc.location.reload(true);
 setTimeout("parent.menc.scrollTo(0, "+sp+")", 100);
}
</script>


AND:

<body onload="ReloadTasks()" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" class="DetailsPage">

I get the reload fine but it goes to the top of the page...It's very curious....I have tested with plain html the scenario and it works just like you said....But it does not work in my app...

Do you have any ideas?

Neil
0
 
nlegaultAuthor Commented:
Zvonko,
            could it be that it's because i am using ASP and a database that it does not work....?

Neil
0
 
ZvonkoSystems architectCommented:
No, it is because you are reloading the complette frameset.
To verify that frame menc is reset to zero position before frame conc can do the reposition, do this test:
Refresh only the rigth frame, the frame conc, by clicking the right mouse button over that frame and selecting refresh for that frame.
You will see that the left upper frame is not repositioned even when reloaded.

Do that test please.

0
 
nlegaultAuthor Commented:
I have set-up 3 examples with the code. http://learning.intermaptechnologies.com/111/index.htm 
2 of them work fine but the one that uses the DB with ASP does not work....I hope it's a typo on my part! i really would like the conc to refresh without the user loosing his place in the menu.

Neil
0
 
nlegaultAuthor Commented:
Hi Zvonko,
                sorry for the wait....Phenomenal !!!!!!!! Great !!!!    This is awesome now...I still have the other script refreshing the page and it works great!

Thanks,

Neil
0
 
ZvonkoSystems architectCommented:
Oh! You are welcome :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.