Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

page refreshes to top 2

Status
Not open for further replies.

jags22

Programmer
Oct 17, 2001
44
US
I have a list of users on a page.
I have a javascript that can preset some information to these users.
Everytime I use the javascript(does what is supposed to do) but takes me to the top of the page.
Is there an attribute or something that I can set to keep the focus where it is???

Thanks...
 
yes. i bet $100 that the call to your function looks like this:

Code:
<a href="#" onclick="blah();">Click</a>

If that is the case, change it to this:

Code:
<a href="#" onclick="blah(); return false;">Click</a>

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
that's what i thought too, here is my code:

<a href="#" onclick="fun(${count.count})"; return false;>use Preset</a>
my compiler is giving me a warning that it doesn't recognize return as an attribute. I don't think it is finding the return false part, but i don't know why.

it is a jsp and has other scripts on it (menu, and calendar script). but it still bounces to the top of the page and is very annoying.

Thanks for the help cLFlaVA, if you think of anything else let me know.
 
Your "return false" is outside of the attribute!

Code:
<a href="#" onclick="fun(${count.count});return false;[red]"[/red]>use Preset</a>

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top