Connecting Tech Pros Worldwide Help | Site Map

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

  #1  
Old March 1st, 2007, 01:55 PM
ameyas
Guest
 
Posts: n/a
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

  #2  
Old March 1st, 2007, 02:05 PM
Evertjan.
Guest
 
Posts: n/a

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


ameyas wrote on 01 mrt 2007 in comp.lang.javascript:
Quote:
"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;"
Quote:
>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;"
Quote:
>G...</a>
and in this sparse case, you would not need any javascript anyway:

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

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
  #3  
Old March 1st, 2007, 02:55 PM
ameyas
Guest
 
Posts: n/a

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



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:
Quote:
ameyas wrote on 01 mrt 2007 in comp.lang.javascript:
>
Quote:
"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;"
>
Quote:
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;"
>
Quote:
G...</a>
>
and in this sparse case, you would not need any javascript anyway:
>
<a
href='http://www.google.com/'target='_blank'
>
Quote:
G...</a>
>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

  #4  
Old March 1st, 2007, 03:25 PM
ASM
Guest
 
Posts: n/a

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


ameyas a écrit :
Quote:
thanks evertjan
>
it ain that straightforward. i am acutally using jfreechart (java
library)
where can we see this curiosity (in action) ?
Quote:
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 ?
Quote:
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 ?
Quote:
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 :
Quote:
Quote:
><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
  #5  
Old March 2nd, 2007, 05:15 AM
ameyas
Guest
 
Posts: n/a

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



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:
Quote:
ameyas a écrit :
>
Quote:
thanks evertjan
>
Quote:
it ain that straightforward. i am acutally using jfreechart (java
library)
>
where can we see this curiosity (in action) ?
>
Quote:
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.
>
Quote:
i do not have a href anywhere.
>
you have certainly one href (and more) !
if not, why to create a map ?
>
Quote:
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 ?
>
Quote:
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 :
>
Quote:
Quote:
<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

Closed Thread