var frame = document.getElementById('site2-frame');
frame.contentWindow.postMessage('Something something something', '*');
<body>
<iframe id="site2-frame" src="http://www.mysite2.com/index.php"></iframe>
</body>
<body>
<input id="input-field" />
</body>
var input = document.getElementById('input-field');
window.addEventListener('message', function(e) {
// Check the origin, accept messages only if they are from YOUR site!
if (/^http://www.mysite1.com/.test(e.origin)) {
input.value = e.data;
// This will be 'Something something something'
}
});