CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  ASP.NET

如何在showModalDialog()打开的窗口写入内容

楼主time_is_life(今夜太冷:http://timeislife.blog.sohu.com)2005-06-03 17:55:46 在 .NET技术 / ASP.NET 提问

win   =   window.showModalDialog('about:blank','','scroll:1;status:0;help:0;resizable:1;);  
  win.document.write('nihao');  
   
  提示说:  
  document为空或者不是对象  
   
  请高手指教! 问题点数:20、回复次数:5Top

1 楼time_is_life(今夜太冷:http://timeislife.blog.sohu.com)回复于 2005-06-03 18:00:29 得分 0

忘了说了,上面的代码是javascript的Top

2 楼remoonwind(血月划风)回复于 2005-06-03 18:02:05 得分 0

showModalDialog   Method  
   
  --------------------------------------------------------------------------------  
   
  Creates   a   modal   dialog   box   that   displays   the   specified   HTML   document.  
   
  Syntax  
   
  vReturnValue   =   window.showModalDialog(sURL   [,   vArguments][,   sFeatures])  
   
  Parameters  
   
  sURL   Required.   String   that   specifies   the   URL   of   the   document   to   load   and   display.    
  vArguments   Optional.   Variant   that   specifies   the   arguments   to   use   when   displaying   the   document.   Use   this   parameter   to   pass   a   value   of   any   type,   including   an   array   of   values.   The   dialog   box   can   extract   the   values   passed   by   the   caller   from   the   dialogArguments   property   of   the   window   object.    
  sFeatures   Optional.   String   that   specifies   the   window   ornaments   for   the   dialog   box,   using   one   or   more   of   the   following   semicolon-delimited   values:   dialogHeight:iHeight     Sets   the   height   of   the   dialog   window   (see   Remarks   for   default   unit   of   measure).    
  dialogLeft:iXPos     Sets   the   left   position   of   the   dialog   window   relative   to   the   upper-left   corner   of   the   desktop.    
  dialogTop:iYPos     Sets   the   top   position   of   the   dialog   window   relative   to   the   upper-left   corner   of   the   desktop.    
  dialogWidth:iWidth     Sets   the   width   of   the   dialog   window   (see   Remarks   for   default   unit   of   measure).    
  center:{   yes   |   no   |   1   |   0   }   Specifies   whether   to   center   the   dialog   window   within   the   desktop.   The   default   is   yes.    
  help:{   yes   |   no   |   1   |   0   }   Specifies   whether   the   dialog   window   displays   the   context-sensitive   Help   icon.   The   default   is   yes.    
  resizable:{   yes   |   no   |   1   |   0   }   Specifies   whether   the   dialog   window   has   set   dimensions.   The   default   for   both   trusted   and   untrusted   dialog   windows   is   no.    
  status:{   yes   |   no   |   1   |   0   }   Specifies   whether   the   dialog   window   displays   a   status   bar.   The   default   is   yes   for   untrusted   dialog   windows   and   no   for   trusted   dialog   windows.    
     
   
  Return   Value  
   
  Variant.   Returns   the   value   of   the   returnValue   property   as   set   by   the   window   of   the   document   specified   in   sURL.  
   
  Remarks  
   
  A   modal   dialog   box   retains   the   input   focus   while   open.   The   user   cannot   switch   windows   until   the   dialog   box   is   closed.  
   
  Because   a   modal   dialog   box   can   include   a   URL   to   a   resource   in   a   different   domain,   do   not   pass   information   through   the   vArguments   parameter   that   the   user   might   consider   private.  
   
  As   of   Microsoft®   Internet   Explorer   4.0,   you   can   eliminate   scroll   bars   on   dialog   boxes.   To   turn   off   the   scroll   bar,   set   the   SCROLL   attribute   to   false   in   the   BODY   element   for   the   dialog   window,   or   call   the   modal   dialog   box   from   a   trusted   application.  
   
  Internet   Explorer   5   allows   further   control   over   modal   dialog   boxes   through   the   status   and   resizable   values   in   the   sFeatures   parameter   of   the   showModalDialog   method.   Turn   off   the   status   bar   by   calling   the   dialog   box   from   a   trusted   application,   such   as   Microsoft®   Visual   Basic®   or   an   HTML   Application   (HTA),   or   from   a   trusted   window,   such   as   a   trusted   modal   dialog   box.   These   applications   are   considered   to   be   trusted   because   they   use   Internet   Explorer   interfaces   instead   of   the   browser.   Any   dialog   box   generated   from   a   trusted   source   has   the   status   bar   turned   off   by   default.   Resizing   is   turned   off   by   default,   but   you   can   turn   it   on   by   specifying   resizable=yes   in   the   sFeatures   string   of   the   showModalDialog   method.  
   
  You   can   set   the   default   font   settings   the   same   way   you   set   cascading   style   sheets   (CSS)   attributes   (for   example,   "font:3;font-size:4").   To   define   multiple   font   values,   use   multiple   font   attributes.  
   
  The   default   unit   of   measure   for   dialogHeight   and   dialogWidth   in   Internet   Explorer   4.0   is   the   em;   in   Internet   Explorer   5   it   is   the   pixel.   For   consistent   results,   specify   the   dialogHeight   and   dialogWidth   in   pixels   when   designing   modal   dialog   boxes.  
   
  Although   a   user   can   manually   adjust   the   height   of   a   dialog   box   to   a   smaller   value—provided   the   dialog   box   is   resizable—the   minimum   dialogHeight   you   can   specify   is   100   pixels.  
   
  To   override   center,   even   though   the   default   for   center   is   yes,   you   can   specify   either   dialogLeft   and/or   dialogTop.  
   
  Example  
   
  This   example   uses   the   showModalDialog   method   to   open   a   customized   dialog   box.  
   
  Hide   Sample   Code  
  <SCRIPT>  
  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>150  
        <OPTION>200  
        <OPTION>250  
        <OPTION>300  
  </SELECT>  
   
  Create   Modal   Dialog   Box  
  <INPUT   TYPE="button"   VALUE="Push   To   Create"    
        onclick="fnOpen()">  
  </FORM>  
   
  Top

3 楼yipiaoqingshui(一瓢清水)回复于 2005-06-03 18:12:15 得分 0

var   theDes   =   "dialogtop:200px;dialogleft:380px;dialogWidth:365px;dialogHeight:450px;edge:sunken;help:no;status:no;scroll:yes;";  
  window.showModalDialog("ContentTreeSetIconsPanel.aspx?contentTypeID="   +   contentTypeID   +   "&ContentTreeID="   +   contentTreeID   +   "&SelectedNodeIndex="   +   selectedNodeIndex   +   "&"   +   queryString   +   "&Rand"   +   Math.random(),   window,   theDes);  
  Top

4 楼time_is_life(今夜太冷:http://timeislife.blog.sohu.com)回复于 2005-06-03 18:18:37 得分 0

win   =   window.showModalDialog('about:blank','','scroll:1;status:0;help:0;resizable:1;);  
  win.document.write('nihao');  
  --------------------------------------------  
  拜托大家看看问题好不好,不要只看到有showModalDialog就信手涂鸦,我想打开一个新的窗口,这个窗口并不存在,所以我用'about:blank',打开这个窗口后我想自己写入html代码。  
   
  Top

5 楼net_lover(【孟子E章】)回复于 2005-06-03 18:27:38 得分 20

win   =   window.showModalDialog('about:blank','','scroll:1;status:0;help:0;resizable:1;);  
  win.document.write('nihao');  
  是办不到的,window.showModalDialog返回后才执行下面的语句的  
   
  window.open可以Top

相关问题

  • 打开文件写入内容怎样才能不覆盖以前的内容?
  • 用javascript打开一个本地硬盘上的xml文件,写入内容,并存成新的文件?
  • 打开网络上的一个excel文件,向里面写入内容,能给我写个实例吗?(急等)
  • 用 Append、Binary、Input、Output、或 Random 方式打开的文件然后写入内容,别的程序能获取到正常的内容吗?
  • 如何用二进制打开一个文件,并把其内容写入另一个相同类型文件中?100分
  • 文件内容的写入与读出?
  • 关于向TXT写入内容,Writeln/Rewrite
  • showModalDialog打开页面
  • 写入文件的数据,打开是乱码,怎么办???
  • 如何向打开的记事本写入一段文本???

关键词

  • document
  • showmodaldialog
  • dialog box
  • specifies
  • px
  • win
  • displaying

得分解答快速导航

  • 帖主:time_is_life
  • net_lover

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo