scraping can be tricky, especially with text segments.
i often use
my handy node getter for these types of situations.
indeed, it seemed to work like a charm on the markup you posted:
Code:
<body>
<div style="display: none;" id="questiondiv">
You challenge The Wiseman to a game of trivia, he asks you this question:<br/> <br/>
<!--store from here-->What did David Stirling find?<!--to here in a var--> (Hint: S__)<br/> <br/>
<input class="dungeoninput" type="text" size="16" id="answer" value="" maxlength="32"></input><br/>
<div class="btn100" style="margin-top: 6px;"
onclick="loadDiv2('/dream/explore?action=acceptTrivia&qid=727'); return false;">Answer</div>
</div>
<script>
function getNodes(prop, val, meth, nd, useSelf ){
var r=[], any= getNodes[val]===true;
nd=nd||document.documentElement;
if(nd.constructor===Array){nd={childNodes:nd};}
for(var cn=nd.childNodes, i=0, mx=cn.length;i<mx;i++){
var it=cn[i];
if( it.childNodes.length && !useSelf ){r=r.concat(getNodes(prop, val, meth, it,useSelf ));}
if( any ? it[prop] : (it[prop]!==undefined && (meth ? ""[meth] &&
String(it[prop])[meth](val) : it[prop]==val))){
r[r.length]=it;
}
}//nxt
return r;
};getNodes[null]=true;getNodes[undefined]=true;
//end getNodes()
//example: (modify arguments to suit your needs)
alert(
getNodes(
"data", //examine each node's .data property (only hits text nodes)
/\?/, //looking for text with a "?"
"match", //using String().match method to accept arguments[1]
document.getElementById("questiondiv") // looking in the question div
)[0].textContent //show text of first match
);
</script>
</body>