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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROBLEM: OnClick Link Sends Scroll to TOP

Status
Not open for further replies.

Chinyere

Programmer
Mar 9, 2001
79
US
Hello All,

Help ASAP!!!

I have inherited a project with ASP code and I am not really an ASP person.

This is the code:

Code:
<a href=&quot;#&quot; 
onClick=&quot;window.open('showByDate_detail.asp?f_ID=<%=rsDC.Fields(&quot;bc_key&quot;)%>','','resizable=yes,menubar=yes,scrollbars=yes,height=300,width=400')&quot;><i>
<%= rsDc.Fields(&quot;bc_Title&quot;) %></i></a>

The whole page consists of links. The problem is that when someone clicks the link (code above), it opens a new window, yes, BUT it scrolls the original page to the top. I guess that this a function of the #.

How do I rewrite this code to open a new page while keeping the scroll position? I am not a javascript person either so any (explicit) help would be appreciated.

Thanks!

Chinyere
 
Just add return false to the end of it.

<a href=&quot;#&quot;
onClick=&quot;window.open('showByDate_detail.asp?f_ID=<%=rsDC.Fields(&quot;bc_key&quot;)%>','','resizable=yes,menubar=yes,scrollbars=yes,height=300,width=400');return false&quot;><i>
<%= rsDc.Fields(&quot;bc_Title&quot;) %></i></a>
&quot;did you just say Minkey?, yes that's what I said.&quot;

MrGreed
 
Another option:

<a href=&quot;showByDate_detail.asp?f_ID=<%=rsDC.Fields(&quot;bc_key&quot;)%>&quot; target=&quot;popup&quot; onClick=&quot;window.open('','popup','resizable=yes,menubar=yes,scrollbars=yes,height=300,width=400');return false&quot;>
<i><%= rsDc.Fields(&quot;bc_Title&quot;) %></i>
</a>
-K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top