View Single Post

  #8 (permalink)  
Old 10-06-2007
tedd
 
Posts: n/a
Default Re: [PHP] A two flavored post

At 1:26 PM -0400 10/5/07, Nathan Nobbe wrote:
>strange; i missed that when i put it together; my bad, it was late.
>here is a revision that works.
>
><html>
> <head>
> <script type="text/javascript">
> window.onload = function() {
> var someLink = document.getElementById('someLink');
> someLink.href += "&anotherVar=8";
> alert(document.getElementById('someLink').href);
> }
> </script>
> </head>
> <body>
> <a id="someLink" href=" http://somesite.com?a=5">
> click here
> </a>
> </body>
></html>
>
>the problem was the local variable was being assigned the value of the
>attribute, not the reference
>to the tag in the dom. i have now set it to be a reference to the variable
>in the dom.


-nathan:

Not that I provided information otherwise, but
document.getElementById won't work in this case because there are
several links involved. As such, I have to use
document.getElementByClass and that has problems.

Unfortunately, my solution isn't unobtrusive.

<a href="img.php?i=<?php echo($value);?>" onclick="window.location =
this.getAttribute( 'href' ) + '&s=' + s; return false;">

However, I couldn't see a way to make it so.

Many thanks for your time and effort.

Cheers,

tedd


--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Reply With Quote