Re: Change Text into Links
- From: "Evertjan." <exjxw.hannivoort@xxxxxxxxxxxx>
- Date: 08 Jul 2009 14:03:31 GMT
littleredhairedgirl wrote on 08 jul 2009 in
microsoft.public.scripting.jscript:
I have a page that loads some text into a div
What I'd link to do is (re)create each word into a link.
so loop thru each word in the div with innerHtml and wrapping it with
anchor tag
<script language="javascript" type="text/javascript">
Deprecated language code, from the last century
function linkWord(obj){
{
Why twice a { ?
sObj.link="http://groups.google.com/groups/search?q=";
Do you use this in the function? I think not!
for(i in obj){
var x = document.body.innerHTML;
you should var-declare outside the loop
var linkStart = '<a href="'+ x +'">';
same
x is not an url, it is the innerHTML of body.
var linkEnd = '&btnG=Search&sitesearch=groups.google.com</a>';
so &btnG=Search&sitesearch=groups.google.com is the text to be clicked?
x = linkStart + x + linkEnd);
document.body.innerHTML = x;
And for every instance of the link you overwrite the whole body?
}
missing }
The function is not called.
</script>
I suppose you first learn the basics of Javascript.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
.
- References:
- Change Text into Links
- From: littleredhairedgirl
- Change Text into Links
- Prev by Date: Change Text into Links
- Next by Date: ADO, byte array и JavaScript: access to array's elements
- Previous by thread: Change Text into Links
- Next by thread: ADO, byte array и JavaScript: access to array's elements
- Index(es):
Relevant Pages
|