|
-
Catfish
HTML/Jscript problem
I have the following code within my HTML document - it opens a new window with a left click, and a standard right click open, but fails with "Cannot find server" when I try and open in a new window:
<A HREF="javascript :openImage('picture.jpg',361,550,'descriptio n')">
<img src="smallpicture.jpg" width=131 height=200 border=0></a>
The function openImage is contained in separate .JS file referenced by a script tag in the calling document.
Any idea how to make it work correctly when open in a new window is chosen as well?
-
Ursus Arctos Moderatis
The answer is short and sweet, you can't.
When you right click and choose to open a new window, it's a very "dumb" function which simply passes the contents of the HREF attributes of the anchor tag to a new browser window. In your case, you're using a client-side JavaScript call in your HREF attribute. So that JavaScript statement is passed as an address to a new window, which obviusly is not a valid address.
What you *could* do, is write a JavaScript function to capture the onMouseDown event, and if the button clicked was the right mouse button, explicitly trigger the openImage() function.
Honestly though, I really don't see this as a very big deal. I've seen this issue on a number of big name sites (CNN, Yahoo, etc etc). Most users don't even know about the rightclick/open new window function.
-
Catfish
Grizzly: Thanks for the reply! I was hoping that there was something simple I was missing, like a way to form the call so it knew where it was being called from. I can now stop banging my head against a wall trying to figure it out
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|