Html程序  |  79行  |  1.49 KB

<!doctype html>
<!--
@MAC-DENY:AXTitle*
@MAC-DENY:AXValue*
@MAC-ALLOW:position*
@MAC-ALLOW:size*

@WIN-DENY:title*
@WIN-ALLOW:location*
@WIN-ALLOW:size=(300, 150)
@WIN-ALLOW:size=(300, 100)
@WIN-ALLOW:size=(250, 50)
@WIN-ALLOW:size=(150, 50)
@WIN-ALLOW:IA2_STATE_EDITABLE
-->
<html>
<head>
<style>
body {
  overflow: hidden;
}
iframe {
  border: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
div {
  width: 300px;
  height: 150px;
}
</style>
</head>
<body style="margin: 0; padding: 0;">

<div>
  <button style="margin: 25px; border: 0; width: 250px; height: 50px">
    Button
  </button>
</div>

<div>
  <button style="margin: 25px; border: 0; width: 250px; height: 50px">
    Button
  </button>
</div>

<div><iframe id="frame1" style="width: 300px; height: 100px;" scrolling="no"></iframe></div>

<div><iframe id="frame2" style="width: 150px; height: 50px;" scrolling="no"></iframe></div>

<script>
var frameCode =
    '<body style="margin: 0; padding: 0;">\n' +
    '<div style="width: 300px; height: 100px;">\n' +
    '  <button style="margin: 25px; border: 0; width: 250px; height: 50px">\n' +
    '    Button\n' +
    '  </button>\n' +
    '</div>\n' +
    '</body>\n';

function writeFrameCode(frame) {
  var doc = frame.contentWindow.document;
  doc.open();
  doc.write(frameCode);
  doc.close();
}

var frame1 = document.getElementById('frame1');
writeFrameCode(frame1);

var frame2 = document.getElementById('frame2');
writeFrameCode(frame2);
frame2.contentWindow.scrollTo(150, 50);
</script>
  
</body>
</html>