E
Evan
Hey, I posted this yesterday, but no one had any ideas? C'mon now, I
know this isn't that hard, i'm just a little new to javascript, and I
can't quite figure this out. I searched and searched to try and find
the answer to this, but I had no luck anywhere. It's a little
different situation than I found anywhere else. I would simply put
javascript into the <a> tag, but like I said, It's delivered via PHP,
and I don't have access to it. I could really, really, really use your
help here.
Here's what I posted yesterday, (sorry for the repeat, but I really
need some help here) :
<begin quote>
Ok, so I need to change the href of a link on our php driven auction
calendar. what I need to do is change the href in the "More Info"
button link from "auction_detail.php?ID=91582" to
"http://www.primetimeauctions.com/auctions/2006_auctions/koseris_real_estate/Koseris
Estate.shtml"
I do not have access to the template or scripting that supplies the
html, and whoever designed it used the same name for similar div's,
i.e. EVERY more info button on the page has a div id of
"listMoreButton". So I can't reference the exact div and change it's
href. The reason I need to do this is that the html parser used by our
hosting company is retarded, does not work correctly. look at
http://www.primetimeauctions.com/auction_detail.php?ID=91582 to see
what it does, and
http://www.primetimeauctions.com/auctions/2006_auctions/koseris_real_estate/KoserisEstate.shtml
to see what it's supposed to look like. Where I have that page already
in place and functioning correctly, I would rather just change the link
on the More Info button using JS than make them fix their html upload
utility (because they won't).
We have a sitewide global.js that executes onLoad. it does a variety
of things, and the function(s) i have written to do this simple change
do not work. Here is the code i have :
function kswap() {
var srch = "auction_detail.php?ID=91582";
var replc =
"http://www.primetimeauctions.com/auctions/2006_auctions/koseris_real_estate/KoserisEstate.shtml";
/*if (document.getElementById(listMoreButton).href == srch)
{document.getElementById(listMoreButton).href = replc}*/
for (var i=0; i<(document.links.length); i++)
{
if (document.link.href == srch)
{document.link.href = replc;}
}
}
The commented out seciton was how i originally tried to get this to
work, but there are multiple div's with that id (listMoreButton).
I have spent hours searching and testing with no luck. I couldn't find
anyone in a situation similart to mine. Any help would be appreciated.
If there is any way to change the href of a link delivered through php
with a sitewide javascript that executes on page load, please help
point me in the right direction.
<end quote>
Like I said, it shouldn't be that difficult, but its killing me and
eating up time that I need to be spending on other things. Another
idea I had would be a simple text based search and replace done with
java. I don't need this scripting to be "smart", I just need it to
blindly replace one literal string (that happens to be an href, buried
in html, delivered by php) with another string. If there is a more
simple, literal string replacement is possible, fine with me...just
point me at the code.
Thanks Again,
Evan
know this isn't that hard, i'm just a little new to javascript, and I
can't quite figure this out. I searched and searched to try and find
the answer to this, but I had no luck anywhere. It's a little
different situation than I found anywhere else. I would simply put
javascript into the <a> tag, but like I said, It's delivered via PHP,
and I don't have access to it. I could really, really, really use your
help here.
Here's what I posted yesterday, (sorry for the repeat, but I really
need some help here) :
<begin quote>
Ok, so I need to change the href of a link on our php driven auction
calendar. what I need to do is change the href in the "More Info"
button link from "auction_detail.php?ID=91582" to
"http://www.primetimeauctions.com/auctions/2006_auctions/koseris_real_estate/Koseris
Estate.shtml"
I do not have access to the template or scripting that supplies the
html, and whoever designed it used the same name for similar div's,
i.e. EVERY more info button on the page has a div id of
"listMoreButton". So I can't reference the exact div and change it's
href. The reason I need to do this is that the html parser used by our
hosting company is retarded, does not work correctly. look at
http://www.primetimeauctions.com/auction_detail.php?ID=91582 to see
what it does, and
http://www.primetimeauctions.com/auctions/2006_auctions/koseris_real_estate/KoserisEstate.shtml
to see what it's supposed to look like. Where I have that page already
in place and functioning correctly, I would rather just change the link
on the More Info button using JS than make them fix their html upload
utility (because they won't).
We have a sitewide global.js that executes onLoad. it does a variety
of things, and the function(s) i have written to do this simple change
do not work. Here is the code i have :
function kswap() {
var srch = "auction_detail.php?ID=91582";
var replc =
"http://www.primetimeauctions.com/auctions/2006_auctions/koseris_real_estate/KoserisEstate.shtml";
/*if (document.getElementById(listMoreButton).href == srch)
{document.getElementById(listMoreButton).href = replc}*/
for (var i=0; i<(document.links.length); i++)
{
if (document.link.href == srch)
{document.link.href = replc;}
}
}
The commented out seciton was how i originally tried to get this to
work, but there are multiple div's with that id (listMoreButton).
I have spent hours searching and testing with no luck. I couldn't find
anyone in a situation similart to mine. Any help would be appreciated.
If there is any way to change the href of a link delivered through php
with a sitewide javascript that executes on page load, please help
point me in the right direction.
<end quote>
Like I said, it shouldn't be that difficult, but its killing me and
eating up time that I need to be spending on other things. Another
idea I had would be a simple text based search and replace done with
java. I don't need this scripting to be "smart", I just need it to
blindly replace one literal string (that happens to be an href, buried
in html, delivered by php) with another string. If there is a more
simple, literal string replacement is possible, fine with me...just
point me at the code.
Thanks Again,
Evan