Re: Image OnClick -> JScript -> CGI URL

by "Cyanide _7" <leo7278(at)hotmail.com>

 Date:  Fri, 18 Feb 2000 04:06:10 CST
 To:  gray_s(at)tvq.canon.co.jp
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
the error you are recieving is more than likely due to a lack of quotes 
around the filename in the onClick event handler. the subject of what to 
place in the HREF is still a subject worth discussing. you have several 
options. first and formost, return false from the event handler so the link 
is never followed.  you can place "javascript:void(0)" in the href to do 
absolutely nothing where the *javascript* protocol is supported, or actually 
have a page load. possibly the very page js is to open, but with a _blank 
target. this would be quite practical in the event that js is disabled or 
not supported, your page will still function somewhat gracefully. all in 
all, i'd write the tag like so:

<A
  HREF="/cgi-bin/translator.pl?filename=FF-t01-J9-000032-02.txt&action=help"
  onClick="Help('FF-t01-J9-000032-02.txt'); return false;"
  TARGET="_blank"><IMG
  SRC="../help.jpg" BORDER="0"
  ></A>

good luck! - Cyanide_7

>
>Hi All,
>
>I have a page with an image, and I want to open a smaller window when that 
>image
>  is clicked and have the results of a Perl script dumped to the new 
>window.
>The javascript assembles a URL pointing to the Perl script, and then opens 
>a
>window with that URL.
>
>However, when I click on the image, I get an error.
>
>Here is the Javascript code:
>
><SCRIPT TYPE="text/javascript">
>function Help (filename){
>      myUrl = '/cgi-bin/translator.pl?filename='+filename+'&action=help';
>      Win1 = open
>(myUrl,"HelpWin","width=700,height=200,scrollbars,location,resizable");
>             Win1.status = "Here is the Help File for this Job.";
>             window.close();
>}
></SCRIPT>
>
>and here is the call:
>
>
>
>I think the problem here is that the html code here is written into a frame 
>by
>another perl script,
>so when I make the HREF point to "", it points to the cgi-bin directory, 
>and I
>get a server error
>saying that I can't execute a directory.
>
>Does anyone know where I should point the HREF or how else I could handle 
>this?
>If anyone could offer suggestions, I would appreciate it.
>
>Shawn
>
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA