在网上看到了,就摘录下来了,有机会研究下:
<iframe id=x name=x height="100" style="padding:0px;">iframe><br>
<input type=button onclick=t('UnderLine') value="下划线">
<input type=button onclick=t('bold') value="粗体">
<input type=button onclick=t('JustifyLeft') value="左对齐">
<input type=button onclick=t('JustifyCenter') value="居中对齐">
<input type=button onclick=t('JustifyRight') value="右对齐">
<input type=button onclick=t2() value="增高">
<input type=button onclick=t3() value="减少">
<script>
window.frames["x"].document.designMode="On"
//setTimeout('window.frames["x"].document.designMode="On"',200)
function t(s)
{
window.frames["x"].focus();
o=window.frames["x"].document.selection.createRange();
window.frames["x"].document.execCommand(s);
}
function t2()
{
var obj=window.frames["x"].frameElement;
var height = parseInt(obj.offsetHeight);
if (height+100>=100){
obj.height=height+100;
}
}
function t3()
{
var obj=window.frames["x"].frameElement;
var height = parseInt(obj.offsetHeight);
if (height-100>=100){
obj.height=height-100;
}
}
script>
阅读(179) | 评论(0) | 转发(0) |