That's very nice!
The only downside to your option is if you want to use the onClick on any <a
href> to trigger something else, as well...
/Robert
-----Original Message-----
From: Tim Morford [mailto:tmorford@n...]
Sent: den 22 oktober 2001 17:02
To: JavaScript HowTo
Subject: [javascript_howto] RE: JavaScript Area Href
Thanks but I ended up using this
if (document.layers)
document.captureEvents(Event.CLICK);
document.onclick
function (evt) {
var target
document.all ? event.srcElement :
evt.target;
if (target.href)
target.href = ('test.asp?Name=' + target.href );
then using this to execute it
<%
If Request.QueryString("Name") <> "" THEN
name=Request.QueryString("Name")
host = "http://" & Request.ServerVariables("HTTP_HOST") & "/"
name_a=replace(name,host,"")
Server.Execute(name_a)
else
Response.write("hello")
end if
%>
But thank you very much.
Tim Morford
-----Original Message-----
From: Nyman, Robert [mailto:Robert.Nyman@i...]
Sent: Monday, October 22, 2001 9:09 AM
To: JavaScript HowTo
Subject: [javascript_howto] RE: JavaScript Area Href
Ok, sure. Even easier.
Just do it like this:
var arrAllHrefs = document.getElementsByTagName("a");
for(var i=0; i<arrAllHrefs.length; i++){
var strHref = arrAllHrefs[i].getAttribute("href");
if(strHref){
arrAllHrefs[i].setAttribute("href", ("yadayada.asp?file=" +
strHref));
}
}
/Robert
-----Original Message-----
From: Tim Morford [mailto:tmorford@n...]
Sent: den 22 oktober 2001 14:58
To: JavaScript HowTo
Subject: [javascript_howto] RE: JavaScript Area Href
That is kind of what I need, I need to make the A href = "test.htm" look
like a href ="test.aps?page=test.htm" something like that.
Thank you
Tim Morford
-----Original Message-----
From: Nyman, Robert [mailto:Robert.Nyman@i...]
Sent: Monday, October 22, 2001 8:36 AM
To: JavaScript HowTo
Subject: [javascript_howto] RE: JavaScript Area Href
Do you want the text to appear just before the <a href>?
In that case, something like this should do the trick:
var arrAllHrefs = document.getElemensByTagName("a");
for(var i=0; i<arrAllHrefs.length; i++){
var oTextNode = document.createTextNode("Your text here...");
arrAllHrefs[i].parentNode.appendChild(oTextNode);
}
This depends on the browser...
I should recommend IE 5+ and Netscape 6+.
/Robert
-----Original Message-----
From: Tim Morford [mailto:tmorford@n...]
Sent: den 22 oktober 2001 14:19
To: JavaScript HowTo
Subject: [javascript_howto] JavaScript Area Href
Hey does anyone know of a way that I can change all Area Hrefs on the page
to add some text before it, I am helping out a Friend and he has +,- 3000
pages of stuff that I am helping him make dynamic but we want to be able to
change the href's on the fly so that they all look like there are in the
original table. If anyone has any incite on this, please let me know.
Tim Morford
$subst('Email.Unsub')