PDA

View Full Version : Pull Text off a Page



ditchfieldcaleb
Mar 17th, 2011, 02:21 PM
Is there a way to pull a text off a certain div on a page, and put it into a javascript string? I'm certain that the field has a particular name and id that I can use, if need be.

Philip M
Mar 17th, 2011, 02:29 PM
Not if the page is on a site which is not yours.

In your own page:-


<div id = "mydiv">The content of this div</div>

<script type="text/javascript" >

window.onload=function(){
var str = document.getElementById("mydiv").innerHTML;
alert (str);
}
</script>


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.