Re: A two flavored post

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2007-10-06 at 13:41 -0400, tedd wrote:
> 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.

Why not? I'm guessing because you need to the link to have the
JavaScript variable in it. If this is the case then the href target
should link to a page informing the user that they need to have
JavaScript installed. By doing so you inform them of why clicking on the
link is not having the desired outcome :)

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux