js取iframe中的对象

页面有个id="main"的iframe,iframe加载了一个页面,其中有一个form,id="SubForm".

操作SubForm中的对象
var x=document.getElementById("main");
var y=(x.contentWindow || x.contentDocument);
if (y.document)y=y.document;			
var sf = y.getElementById('SubForm');
sf.startTime.value = $('startTime').value;
sf.endTime.value = $('endTime').value;


作个记录..

你可能感兴趣的:(java)