Re: A two flavored post
| From: | tedd | Date: | Sat, 06 Oct 2007 17:41:29 +0000 |
| Subject: | Re: A two flavored post | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262873@lists.php.net to get a copy of this message | ||
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