![]() | ![]() | ![]() |
| |||||||
| Forums | Register | Groups | Awards | Arcade | Pets | T-Bucks / T-Store | Invite Your Friends | Blogs | Mark Forums Read |
| Web Design Forums and discussions on webdesign |
Web Design | |||||||||
|
|
|
|
| |||||
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Civilians | Hello, could anyone please help me. When using javascript for a link I put a # in the link, like <a href="#" but when someone opens a new window, the old window flicks back to the top, is there any way of stopping this? Thanks for any help Alex |
|
| | #2 (permalink) |
| Civilians | Alex wrote: > Hello, could anyone please help me. When using javascript for a link I put > a # in the link, like <a href="#" Don't do that: <a href="something.html" onclick="somefunction();return false"> where something.html is meaningful to the non-javascript capable, is nearly always preferable. -- http://jibbering.com/faq/#FAQ4_24 > but when someone opens a new window, the old window flicks back to the > top, is there any way of stopping this? Not using popup windows is probably the best solution; they are nearly always a poor design choice. Failing that, see: http://www.allmyfaqs.com/faq.pl?Console_window -- David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/> Home is where the ~/.bashrc is |
|
| | #3 (permalink) |
| Civilians | Alex wrote: > Hello, could anyone please help me. When using javascript for a link > I put a # in the link, like <a href="#" but when someone opens a new > window, the old window flicks back to the top, is there any way of > stopping this? Use code like: <a href="/page.html" onclick="window.open('/page.html','','width=400,height=400'); return false;">link text</a> That way, if the user has JS disabled, or popups blocked, then they /should/ get the new page loaded in the same window/tab that the original site was in. The "return false;" bit simply stops the original page from jumping back to the top. -- Dylan Parry http://webpageworkshop.co.uk -- FREE Web tutorials and references |
|
| | #4 (permalink) |
| Civilians | On Fri, 24 Jun 2005, Alex wrote: > Hello, could anyone please help me. When using javascript for a link I put a > # in the link, like <a href="#" > but when someone opens a new window, the old window flicks back to the top, > is there any way of stopping this? > > Thanks for any help Instead of just using something like this: <a href="#" onclick="OpenWindow('foo.html');">foo</a> add a "return(false);" to the javascript: <a href="#" onclick="OpenWindow('foo.html');return(false);">fo o</a> This should suppress the href="#" for browsers with JavaScript on. Something like this would keep all browsers at approximately the current location (within one screen page) even if they have JavaScript off or the browser doesn't support javascript: <a name="foolabel"> </a> <a href="#foolabel" onclick="OpenWindow('foo.html');return(false);">fo o</a> -- Windows is *not* a "Toy OS". /me desperately trying to hide the URL for the screenshot of my desktop http://www.chebucto.ns.ca/~af380/tem...un-22-2005.gif |
|
| | #5 (permalink) |
| Civilians | "Norman L. DeForest" <af380@chebucto.ns.ca> wrote in message news:Pine.GSO.3.95.iB1.0.1050624113913.16651A-100000@halifax.chebucto.ns.ca... > > -- > Windows is *not* a "Toy OS". > /me desperately trying to hide the URL for the screenshot of my desktop > http://www.chebucto.ns.ca/~af380/tem...un-22-2005.gif Very good. Brian. |
|
| | #6 (permalink) |
| Civilians | Thanks for the help everyone. "Norman L. DeForest" <af380@chebucto.ns.ca> wrote in message news:Pine.GSO.3.95.iB1.0.1050624113913.16651A-100000@halifax.chebucto.ns.ca... > > On Fri, 24 Jun 2005, Alex wrote: > >> Hello, could anyone please help me. When using javascript for a link I >> put a >> # in the link, like <a href="#" >> but when someone opens a new window, the old window flicks back to the >> top, >> is there any way of stopping this? >> >> Thanks for any help > > Instead of just using something like this: > <a href="#" onclick="OpenWindow('foo.html');">foo</a> > add a "return(false);" to the javascript: > <a href="#" onclick="OpenWindow('foo.html');return(false);">fo o</a> > > This should suppress the href="#" for browsers with JavaScript on. > > Something like this would keep all browsers at approximately the > current location (within one screen page) even if they have JavaScript > off or the browser doesn't support javascript: > <a name="foolabel"> </a> > <a href="#foolabel" > onclick="OpenWindow('foo.html');return(false);">fo o</a> > > -- > Windows is *not* a "Toy OS". > /me desperately trying to hide the URL for the screenshot of my desktop > http://www.chebucto.ns.ca/~af380/tem...un-22-2005.gif > |
|
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Links ... Links ... Links (For Katrina) | Woodmonkey | Chit-Chat | 9 | 09-17-2005 01:29 |
| Javascript Error | sfim@iamotelephone.com | Web Design | 5 | 09-09-2005 00:00 |
| Re: A little experiment: CSS/JavaScript | HC | Web Design | 2 | 05-18-2005 00:00 |
| Get-around for Javascript and Win XP SP2 problems | Laphan | Web Design | 6 | 11-21-2004 19:00 |
| Javascript checkbox | Valérie Schüpbach | Web Design | 0 | 07-23-2004 15:05 |
![]() | ![]() | ![]() |