How can I use a link to both run a peice of script and link to another
page?
So far I have the following:
<A href="javascript:GetCookie('linkcookie')">add 1 to linkcookie</A>
You shouldn't use javascript: URIs. They can cause a lot of problems.
Instead, use the onclick intrinsic event. This has the added advantage, in
your case, that it frees up the href attribute and allows it to be used
properly. For example,
<A href="newPage.html" onclick="GetCookie('linkcookie')">Add 1 to
linkcookie</A>
For future reference: when clicked, the above link will first execute the
JavaScript function in the onclick event attribute, then navigate to
newPage.html. If you want to only execute the onclick event code, place a
'return false' statement after the code. For example,
<A href="somePage.html" onclick="someFunction(); return false">Some
link</A>
The primary purpose of a link like the one above is to provide
functionality for users who might not have JavaScript enabled (a sizable
portion of WWW users). With JavaScript enabled, someFunction() will be
executed. Without it, the user will be taken to somePage.html.
Hope I explained that adequately,
Mike