The last thing I cant get to work is to make this part .namefield.value = 'name'; to be based on a textarea.
I've tried altering the value part .value = 'name' to be directed to the form/id's to the textarea itself but that didn't work.
The textarea with submit button I've tried to use comes from dreamweaver;
<form id='input' method='post' action='' >
Name: <input type='text' name='Name' />
<input type='submit' name='submit' value='submit' />
</form>
The html/JavaScript which I am learning with is:
<html>
<head></head>
<body>
<iframe id="main" width="1000" height="1000" src="main.php"></iframe>
<button id="btnMain">Go</button>
<script>
function load() {
var btn = document.getElementById('btnMain');
btn.onclick = function(){
var ifrm = document.getElementById('main');
ifrm.contentWindow.document.forms['searchForm'].namefield.value = 'name';
};
}
window.onload = load;
</script>
</body>
</html>
In JSFiddle: http://jsfiddle.net/Tim_Holt/0a9krnao/
searchFormifrm.contentWindow.document.forms['searchForm'].namefield.value = 'name';putsnamein the field you want to read, then just usex=ifrm.contentWindow.document.forms['searchForm'].namefield.value;to access that value?