473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Href - Please do not reload with target specified

Mel
I have a navigation page, very long list of urls and when you click a
link it is opened in a new window.

THE PROBLEM:

When i scrolldown the navaigator and click on a link, it refreshes
itself, even when i have target specified.

How can i avoid this

thanks in advance

Apr 23 '07 #1
2 1782
While the city slept, Mel (Me*******@gmail.com) feverishly typed...
I have a navigation page, very long list of urls and when you click a
link it is opened in a new window.

THE PROBLEM:

When i scrolldown the navaigator and click on a link, it refreshes
itself, even when i have target specified.

How can i avoid this
It sounds like you are using javascript in the onclick handler to open a
window, and using href="#". This is A Bad Idea. Try using something like;

<a href="myfile.html" onclick="myOpenWinFunc(this.href); return false;">My
File</a>

instead... Obviously replace the myOpenWinFunc() part with whatever you use
to open the window... This would call a function called myOpenWinFunc() with
the value of href (the uri of the file you want to open). The return false
part stops the file in href from being opened. If javascript is not
available - or not enabled - then the file specified in the href will open
normally, so it will work even if javascript is not available to - or not
desired by - the end-user.

Of course, I could have got the wrong end of the stick, in which case I am
sorry... my crystal ball is at the cleaners today ;-)
thanks in advance
You're welcome. Hope it helps.

Cheers,
Nige

--
Nigel Moss http://www.nigenet.org.uk
Mail address will bounce. ni***@DOG.nigenet.org.uk | Take the DOG. out!
"Your mother ate my dog!", "Not all of him!"
Apr 23 '07 #2
nice.guy.nige said the following on 4/23/2007 3:16 PM:
While the city slept, Mel (Me*******@gmail.com) feverishly typed...
>I have a navigation page, very long list of urls and when you click a
link it is opened in a new window.

THE PROBLEM:

When i scrolldown the navaigator and click on a link, it refreshes
itself, even when i have target specified.

How can i avoid this

It sounds like you are using javascript in the onclick handler to open a
window, and using href="#". This is A Bad Idea. Try using something like;

<a href="myfile.html" onclick="myOpenWinFunc(this.href); return false;">My
File</a>
If myOpenWinFunc errors out for any reason, the user still gets a broken
link.

return myOpenWinFunc(this.href)

And then have myOpenWinFunc return false on the very last line.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MotherBored | last post by:
Hello gurus! I am not a javascript person, so I hope there is a simple answer / solution to this problem I'm having. I'm xposting this to the HTML group, if perhaps this is an HTML issue. I...
1
by: Lars Vatland | last post by:
Hello, if i have frameset frame name=A frame name=B How can i target all links in A to B? Via a script in the frameset? (i can only code the frameset file, not the frames) Maybe something...
4
by: Mark Anderson | last post by:
Sorry if this is a rookie mistake... I've been through all the FAQs and the books I have but I can't see the mistake so I guess it's something simple <g> - I'm an occasional JS user. I've got...
11
by: Dana Smith | last post by:
Can anybody explain why when I have a hyperlink on a page with the code similar to below, after the user clicks on the link, the desired window opens but the page with the hyperlink changes to a...
1
by: Marshall Dudley | last post by:
I need to be able to allow a user to submit a form which opens another window. This part I have working. But after the submit, I need to delay and have the original window do a reload. I cannot...
9
by: Kreso | last post by:
i'm passing the asp parameters using the url current page is files.asp and I'm using window.location.href=files.asp?action=deletefile to pass the action to the serverside My code never got...
53
by: usenet | last post by:
See <ul> <li><a name="link1" onClick="alert(this.name);return false;" href="#">Link1</a></li> <li><a name="link2" href="javascript:alert(this);">Link2</a></li> <li>Item 3</li> </ul> ...
0
by: androusm | last post by:
Hi all, I have a problem with reload my servlet with tomcat 5.0.27 My servlet is the one example of the struts "struts-example". I also make changes and want to reload it by tomcat 5.0.27. ...
10
by: schuessi | last post by:
Hello all I'm quite new to web development, so please be kind ;) I have a JS-function called getObjURL() which should return an URL- String of an JS-object. In the body part I use something...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.