<script type="text/javascript">
function fnRandom(iModifier){
return parseInt(Math.random()*iModifier);
}
function fnSetValues(){
var iHeight=oForm.oHeight.options[
oForm.oHeight.selectedIndex].text;
if(iHeight.indexOf("Random")>-1){
iHeight=fnRandom(document.body.clientHeight);
}
var sFeatures="dialogHeight: " + iHeight + "px;";
return sFeatures;
}
function fnOpen(){
var sFeatures=fnSetValues();
window.showModalDialog("showModalDialog_target.htm", "",
sFeatures)
}
</script>
<form name="oForm">
Dialog Height
<select name="oHeight">
<option>-- Random --</option>
<option>150</option>
<option>200</option>
<option>250</option>
<option>300</option>
</select>
Create Modal Dialog Box
<input type="button" value="Push To Create" οnclick="fnOpen()">
</form>pasting
转载于:https://www.cnblogs.com/ahjxxy/archive/2010/01/11/1644224.html