最近做项目用到了javascript的ModalDialog,但是发现在ModalDialog中用javascript就不是很方便了.在写一个超链接调用javascript脚本的时候就会弹出另外一个窗口来写.怎样才能控制ModalDialog的内容呢,郁闷了好久.毕竟我想在输入一些内容以后点关闭ModalDialog,然后刷新父页面或者执行别的操作.原来通过一个变通的方法可以达到,就是使用<iframe>
父页面来打开一个ModalDialog页面:
javascript中ModalDialog的使用<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
javascript中ModalDialog的使用
<html xmlns="http://www.w3.org/1999/xhtml" >
javascript中ModalDialog的使用
<head>
javascript中ModalDialog的使用    
<title>Untitled Page</title>

NoName2.html用一个<iframe>嵌套另外一个页面,来实现调用脚本及其他等操作.
javascript中ModalDialog的使用<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
javascript中ModalDialog的使用
<html xmlns="http://www.w3.org/1999/xhtml" >
javascript中ModalDialog的使用
<head>
javascript中ModalDialog的使用    
<title>Modaldialog Page</title>
javascript中ModalDialog的使用
javascript中ModalDialog的使用
</head>
javascript中ModalDialog的使用
javascript中ModalDialog的使用
<body>
javascript中ModalDialog的使用    
<iframe src="noname3.html"  width="100%" height="100%"></iframe>
javascript中ModalDialog的使用
</body>
javascript中ModalDialog的使用
</html>
javascript中ModalDialog的使用

NoName3.html用来被NoName2.html调用
javascript中ModalDialog的使用<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
javascript中ModalDialog的使用
<html xmlns="http://www.w3.org/1999/xhtml" >
javascript中ModalDialog的使用
<head>
javascript中ModalDialog的使用    
<title>src Page</title>

 

因为NoName3.html是被NoName2.html调用,所以可以设置ModalDialog的returnvalue,但是需要通过window.parent.returnValue进行赋值。在打开ModalDialog页面可以得到returnValue,我在第一个页面把returnValue赋值给了Div,能够看到效果,在实际操作的时候可以通过把原页面根据returnValue状态对页面进行重新加载等.

相关文章:

  • 2021-08-24
  • 2022-02-11
  • 2021-09-28
  • 2021-11-21
  • 2021-10-11
猜你喜欢
  • 2021-09-20
  • 2021-11-17
  • 2021-05-11
  • 2022-02-07
  • 2022-02-09
相关资源
相似解决方案