You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ed Hillmann <ed...@gmail.com> on 2009/09/02 05:57:13 UTC

Q: How can I define a link that calls a Javascript function?

Hi all.  I've trying to write some documentation in xdoc, that defines web
pages that are generated by Maven.

I've been able to update the site.xml document so that I can define some
Javascript functions in the HTML's <head> element.  That's all good.  When I
generate the page, I can see the Javascript methods where I expect them.

My problem is trying to call them using an anchor element.  Whenever I
define an anchor element that tries to call the javascript function

<a href="javascript:FunctionName">

the link that is generated thinks I mean an anchor in the same page.  So, it
comes out

<a href=path/to/html/file.html#javascript:FunctionName">

So, when I click on it, nothing happens because there's no achor with that
value.

Is there a specific syntax I should be using to get the anchors defined so
that they can call javascript methods defined within the HTML itself?

Thanks for any help,
Ed

Fwd: Q: How can I define a link that calls a Javascript function?

Posted by Ed Hillmann <ed...@gmail.com>.
I found the problem, and it was me.

I did not define the Javascript method correctly in the anchor.  Using the
example I cited:

<a href="javascript:FunctionName">

This was wrong.  When I define it correctly:

<a href="javascript:FunctionName()">

It worked as expected.

Sorry for the interruption.

Thanks,
Ed

---------- Forwarded message ----------
From: Ed Hillmann <ed...@gmail.com>
Date: Wed, Sep 2, 2009 at 1:57 PM
Subject: Q: How can I define a link that calls a Javascript function?
To: Maven Users List <us...@maven.apache.org>


Hi all.  I've trying to write some documentation in xdoc, that defines web
pages that are generated by Maven.

I've been able to update the site.xml document so that I can define some
Javascript functions in the HTML's <head> element.  That's all good.  When I
generate the page, I can see the Javascript methods where I expect them.

My problem is trying to call them using an anchor element.  Whenever I
define an anchor element that tries to call the javascript function

<a href="javascript:FunctionName">

the link that is generated thinks I mean an anchor in the same page.  So, it
comes out

<a href=path/to/html/file.html#javascript:FunctionName">

So, when I click on it, nothing happens because there's no achor with that
value.

Is there a specific syntax I should be using to get the anchors defined so
that they can call javascript methods defined within the HTML itself?

Thanks for any help,
Ed