我試圖捕捉到HTML捕捉標題和元標記從一個textarea
從
<title></title>
和Metadata
在form1
但不完全知道如何做到這一點?
我的問題是這樣做的:document.write(document.form1.title);
或document.write.texteara.(document.form1.title);
但這不適用於我...
<textarea name="textarea" id="textarea" cols="45" rows="5"><title>This is the title tag extracted</title><meta name="keywords" content="test 1, test 2, test3" /></textarea>
</label>
</form>
<script type="text/javascript" src="<%= g_page_site_actual %>/js/jquery-1.4.2.min.js"></script>
<script language="JavaScript"><!--
if (document.getElementsByName) {
var metaArray = document.getElementsByName('Author');
for (var i=0; i<metaArray.length; i++) {
document.write(metaArray[i].content + '<br>');
}
var metaArray = document.getElementsByName('Description');
for (var i=0; i<metaArray.length; i++) {
document.write(metaArray[i].content + '<br>');
}
var metaArray = document.getElementsByName('Keywords');
for (var i=0; i<metaArray.length; i++) {
document.write(metaArray[i].content + '<br>');
}
}
document.write(document.form1.title);
//--></script>
任何想法如何從textarea中捕獲元數據?