Forum Moderators: open

Message Too Old, No Replies

Javascript, Can it be done?

Copy text from one part of page to another

         

CWebguy

12:27 pm on May 4, 2008 (gmt 0)

10+ Year Member



Hey guys!
Due to the limitations on one of my blogs(I've learned my lesson!), I was wondering if there might be a javascript function (or one that would even be possible to write) in which text (about 50 words) could be taken from further down on the page and copied (Meta tag). Is this possible? If so, what are the options?

Also, would this effect spiderbots?

Thanks a bunch!
Lance

[edited by: CWebguy at 12:31 pm (utc) on May 4, 2008]

birdbrain

4:05 pm on May 4, 2008 (gmt 0)



Hi there CWebguy,

Is this possible?

It is quite easy to dynamically add a meta tag to the head section of the document. ;)

Also, would this effect spiderbots?

That I cannot answer as I have no experience in those matters. ;)

Here is the meta tag script...


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">
window.onload=function(){

m=document.createElement('meta');
m.setAttribute('name','description');
m.setAttribute('content',document.getElementById('info').firstChild.nodeValue);
document.getElementsByTagName('head')[0].appendChild(m);

/*************** test for code application ***************/

alert(document.getElementsByTagName('meta')[1].content)

/**** change the [1] value to suit the meta position ****/

/********************************************************/

}
</script>

</head>
<body>

<div id="info">free help for javascript jscript vbscript actionscript dhtml cgi php html xhtml css xml xls sql asp flash java and other topics</div>

</body>
</html>


birdbrain