Faqts

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

30 of 37 people (81%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How can I avoid getting on top of a url/page when I refresh it and scroll down instead to read it's

Mar 24th, 2009 17:43
chat alarab, i can do it, Rajvir Singh, Andrew Engels Rump, Deepak Sharma, josh oshiro, mitsaras ole, chat


I assume you are refering to a webpage generated by asp, php, cgi, perl 
or something like that and that you want it to display a spot somewhere 
in the middle of the page by defualt rather than returning to the top 
of the page when it refreshes. If that is the case, then here is one 
way to accomplish this.
If you are not using frames, use a combination of meta refresh and id 
tags to position the scroll bar where you want it. To do this you need 
to wrap your page content in div tags with the id property set to 
unique names and use meta refresh tags to send the browser scroll bar 
straight to the desired content.
This example will scroll you striaght to the content between the div 
tags which have their id= set to "gohere".
<html>
<head>
<title>Example Page</title>
<meta http-equiv="refresh" content="0;URL=#gohere">
</head>
<body>
<table>
  <tr>
    <td width="600" valign="top">
      <pre>
A bunch of crud we'd rather not see.
                ||
                ||
               \  /
                \/
</pre>
    </td>
  </tr>
  <tr>
    <td width="600" valign="top">
      blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa 
      blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa 
      blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa 
      blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa 
      blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa 
      blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa blaa 
    </td>
  </tr>
  <tr>
    <td width="600" valign="bottom">
      <pre>
                /\
               /  \
                ||
                ||
A bunch of crud we'd rather not see.
      </pre>
    </td>
  </tr>
  <tr>
    <td width="600" height="800" valign="top">
      <div id="gohere">
        <pre>
   The stuff we do want to see.
                ||
                ||
               \  /
                \/
        </pre>
      </div>
    </td>
  </tr>
</table>
</body>
</html>
If you intend on doing this in php and you can't figure it out let me 
know and i will post a php example.
--------------------------------------------------
You can also use javascript and a "Named anchor" combo to jump to a 
specific location. But I think the above mentioned method is better. If 
it is cross-browser compatible.
Ansheel
http://www.rajasthantravelsguide.com/website-design-company-rajasthan.html
--------------------------------------------------
Using plain named anchor should also do the trick.
Write:
<a name="GoHere">First dynamicly added line</a><br>
Second dynamicly added line<br>
...
When refreshring add #GoHere to the URL, e.g.,
http://www.aaa.invalid#GoHere
http://www.stupidarticles.com
http://www.halazona.com
http://www.shikapika.com
http://www.stakoza.com
http://www.uploadarticles.com
http://www.ganazat.com
http://www.damima.com
http://www.tarabiza.com
http://www.articlesxarticles.com
http://www.articlesfreedirectory.com