469,329 Members | 1,391 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,329 developers. It's quick & easy.

pop up URL based on image map ... return false for the main window

hi all,

i am using an image which has image map and i provide the href action
url. i have provided the url to open a pop up window like
"javascript:window.open('www.google.com');" but on clicking the image,
the page (main window) gets refreshed in the background the pop up
opens as desired.

is there a way to cancel the refreshing of page ? i tried

"javascript:window.open(www.google.com); return false;" gives error
so itried
"javascript:new function() { window.open(www.google.com); return
false; }"
but that didn stop refreshing the page either.

i also tried adding onclick function and then return false from there
but in that case the map does not work (no pop up) and i dont get the
required details from the image area.

how do i achieve this ?

thanks & regards
amey

Mar 1 '07 #1
4 4921
ameyas wrote on 01 mrt 2007 in comp.lang.javascript:
"javascript:window.open(www.google.com); return false;" gives error
window.open expects a string for an url,
litteral strings need to be deliminated by quotes in javascript,
and needs http://:

<a
href="javascript:window.open('http://www.google.com'); return false;"
>G...</a>
Better, because not everyone has javascript active, is:

<a
href='http://www.google.com/' target='_blank'
onclick="window.open(this.href); return false;"
>G...</a>
and in this sparse case, you would not need any javascript anyway:

<a
href='http://www.google.com/' target='_blank'
>G...</a>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 1 '07 #2

thanks evertjan

it ain that straightforward. i am acutally using jfreechart (java
library) to generate chart images. i need to pass string as argument
which is used as prefix in generating maps for that chart.
so i wanted to know if is there any way where by i can cancel the
refreshing.

i do not have a href anywhere.
its all handled internally by jfreechart to generate map. all i can do
is pass some javascript statement within the string.

so target _blank should not work in my case.
all i have is access to img tag which uses auto-generated map. and
string URL which can contain javascript statements like
javascript:window.open(); ..... return false etc.
this string i pass as parameter to jfreechart APIs to generate image
map.

hope i made myself clear :)

thanks & regards
amey
On Mar 1, 6:57 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
ameyas wrote on 01 mrt 2007 in comp.lang.javascript:
"javascript:window.open(www.google.com);return false;" gives error

window.open expects a string for an url,
litteral strings need to be deliminated by quotes in javascript,
and needs http://:

<a
href="javascript:window.open('http://www.google.com');return false;"
G...</a>

Better, because not everyone has javascript active, is:

<a
href='http://www.google.com/'target='_blank'
onclick="window.open(this.href); return false;"
G...</a>

and in this sparse case, you would not need any javascript anyway:

<a
href='http://www.google.com/'target='_blank'
G...</a>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Mar 1 '07 #3
ASM
ameyas a écrit :
thanks evertjan

it ain that straightforward. i am acutally using jfreechart (java
library)
where can we see this curiosity (in action) ?
to generate chart images. i need to pass string as argument
which is used as prefix in generating maps for that chart.
so i wanted to know if is there any way where by i can cancel the
refreshing.

i do not have a href anywhere.
you have certainly one href (and more) !
if not, why to create a map ?
its all handled internally by jfreechart to generate map. all i can do
is pass some javascript statement within the string.
What is this tool that can do almost nothing ?
Of course you have no NotePad or similar ?
hope i made myself clear :)
Hope you can code at home with your NotePad to correct what your java
tool can't make.

Any way Evertjan has given you what to type :
><a
href="javascript:window.open('http://www.google.com');return false;"
with your java tool when it asks url :

javascript:window.open('http://www.google.com');return false;

the real url is between '

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Mar 1 '07 #4

Hi ASM,

jfreechart (http://www.jfree.org/jfreechart) is not a tool, its an
opensource java library (not an editor) to generate chart images
dynamically based on some data. it supports drill down of charts using
image maps so based on where you clicked on the chart, you can further
drill down the chart with selected info.

now it takes URL as the parameter and it automatically appends the
parameters based on the image map.
for ex if you have a yearly bar chart to show sales in 12 months, and
when the user clicks on one particular month, the selected month will
be appended to the URL prefix (which i provide).

now here i can only pass string URL prefix. but i can pass URL
something like
"javascript:window.open('http://localhost:8080/myServlet');"
this will hit the given URL and append the selected month as parameter

now i wanted to know if is there any statement (return false din work)
which can stop refreshing the background page?
event.cancelBubble = true din work as well.
thanks & regards
amey
On Mar 1, 8:18 pm, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
ameyas a écrit :
thanks evertjan
it ain that straightforward. i am acutally using jfreechart (java
library)

where can we see this curiosity (in action) ?
to generate chart images. i need to pass string as argument
which is used as prefix in generating maps for that chart.
so i wanted to know if is there any way where by i can cancel the
refreshing.
i do not have a href anywhere.

you have certainly one href (and more) !
if not, why to create a map ?
its all handled internally by jfreechart to generate map. all i can do
is pass some javascript statement within the string.

What is this tool that can do almost nothing ?
Of course you have no NotePad or similar ?
hope i made myself clear :)

Hope you can code at home with your NotePad to correct what your java
tool can't make.

Any way Evertjan has given you what to type :
<a
href="javascript:window.open('http://www.google.com');returnfalse;"

with your java tool when it asks url :

javascript:window.open('http://www.google.com');returnfalse;

the real url is between '

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date

Mar 2 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Mekon | last post: by
8 posts views Thread by Michael Satterwhite | last post: by
6 posts views Thread by anonymous | last post: by
4 posts views Thread by yatin | last post: by
1 post views Thread by rsteph | last post: by
15 posts views Thread by javelin | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.