How can I get the text value from an elements's child?
Say I have this code on a page:
<div class='geshitop'>
[ CODE ] [ <a href="#" onclick="javascript:copy(); return false;">PLAIN-TEXT</a> ]
</div>
<div class='geshimain'>
<pre><div class="text" style="font-family:monospace;">Code goes here...</div></pre>
</div>
The function copy()
:
<script type="text/javascript">
function copy() {
var text = this.parent.getElementsByName("text");
var code = text[0].value;
var popup = window.open("", "window", "resizeable,width=400,height=300");
popup.document.write("<textarea name='code' cols='40' rows='15'></textarea>");
popup.code.value = code;
}
How would I go about getting that child's data: the <div class "text">
. How can I get that from the parent?