不好意思,因为我对vbscript不熟,只好加了一点javascript的代码,可以解决,或者你照着看看,改成vbscript
<html>
<head>
<title>h1.html</title>
</head>
<body>
<form id="Form1" method="post">
<INPUT id="t3" style="Z-INDEX: 104; LEFT: 49px; WIDTH: 217px; POSITION: absolute; TOP: 141px; HEIGHT: 46px" type="text" size="30" onfocus=myfocus("t3")>
<INPUT id="t2" style="Z-INDEX: 103; LEFT: 55px; WIDTH: 217px; POSITION: absolute; TOP: 93px; HEIGHT: 46px" type="text" size="30" onfocus=myfocus("t2")>
<INPUT id="t4" style="Z-INDEX: 102; LEFT: 50px; WIDTH: 217px; POSITION: absolute; TOP: 188px; HEIGHT: 46px" type="text" size="30" onfocus=myfocus("t4")>
<INPUT id="t1" style="Z-INDEX: 101; LEFT: 57px; WIDTH: 217px; POSITION: absolute; TOP: 43px; HEIGHT: 46px" type="text" size="30" onfocus=myfocus("t1")>
<INPUT id="b1" style="Z-INDEX: 105; LEFT: 37px; WIDTH: 162px; POSITION: absolute; TOP: 239px; HEIGHT: 50px" type="button" value="Button"></form>
</form>
</body>
<script language="vbscript">
Sub b1_onclick()
Dim vRet, oMe
Set oMe = Window
vRet = showModelessDialog ( _
"h2.html", _
oMe, _
"dialogHeight:340px;dialogWidth:450px;center:yes;status:no;resizable:no;help:no")
Set oMe = Nothing
End Sub
</script>
<script>
var myfocustext=null;
function myfocus(obj)
{
myfocustext=obj;
}
</script>
</html>
///////////////////////////////////
<html>
<head>
<title>h1.html</title>
</head>
<body>
<form id="Form1" method="post">
<INPUT id="b1" onclick=myset() style="Z-INDEX: 101; LEFT: 12px; WIDTH: 403px; POSITION: absolute; TOP: 8px; HEIGHT: 47px" type="button" value='click的时候,我要把"1234"放在h1.html中最后获得焦点txtbox中'>
</form>
</body>
<script language="vbscript">
Option Explicit
dim oPW '父窗口
'''''''''''''''''''''''''''''''''''''''''''
Sub window_onload()
Set oPW = window.dialogArguments
End Sub
'''''''''''''''''''''''''''''''''''''''''''
Sub b1_onclick
'msgbox "这里要怎么写呢?"
'opw.document.all.t1.value="1234"
End Sub
</script>
<script>
function myset()
{
opw.document.all[opw.myfocustext].value="1234";
}
</script>
</html>
<html>
<head>
<title>h1.html</title>
</head>
<body>
<form id="Form1" method="post">
<INPUT id="t3" style="Z-INDEX: 104; LEFT: 49px; WIDTH: 217px; POSITION: absolute; TOP: 141px; HEIGHT: 46px" type="text" size="30" onfocus=myfocus("t3")>
<INPUT id="t2" style="Z-INDEX: 103; LEFT: 55px; WIDTH: 217px; POSITION: absolute; TOP: 93px; HEIGHT: 46px" type="text" size="30" onfocus=myfocus("t2")>
<INPUT id="t4" style="Z-INDEX: 102; LEFT: 50px; WIDTH: 217px; POSITION: absolute; TOP: 188px; HEIGHT: 46px" type="text" size="30" onfocus=myfocus("t4")>
<INPUT id="t1" style="Z-INDEX: 101; LEFT: 57px; WIDTH: 217px; POSITION: absolute; TOP: 43px; HEIGHT: 46px" type="text" size="30" onfocus=myfocus("t1")>
<INPUT id="b1" style="Z-INDEX: 105; LEFT: 37px; WIDTH: 162px; POSITION: absolute; TOP: 239px; HEIGHT: 50px" type="button" value="Button"></form>
</form>
</body>
<script language="vbscript">
Sub b1_onclick()
Dim vRet, oMe
Set oMe = Window
vRet = showModelessDialog ( _
"h2.html", _
oMe, _
"dialogHeight:340px;dialogWidth:450px;center:yes;status:no;resizable:no;help:no")
Set oMe = Nothing
End Sub
</script>
<script>
var myfocustext=null;
function myfocus(obj)
{
myfocustext=obj;
}
</script>
</html>
///////////////////////////////////
<html>
<head>
<title>h1.html</title>
</head>
<body>
<form id="Form1" method="post">
<INPUT id="b1" onclick=myset() style="Z-INDEX: 101; LEFT: 12px; WIDTH: 403px; POSITION: absolute; TOP: 8px; HEIGHT: 47px" type="button" value='click的时候,我要把"1234"放在h1.html中最后获得焦点txtbox中'>
</form>
</body>
<script language="vbscript">
Option Explicit
dim oPW '父窗口
'''''''''''''''''''''''''''''''''''''''''''
Sub window_onload()
Set oPW = window.dialogArguments
End Sub
'''''''''''''''''''''''''''''''''''''''''''
Sub b1_onclick
'msgbox "这里要怎么写呢?"
'opw.document.all.t1.value="1234"
End Sub
</script>
<script>
function myset()
{
opw.document.all[opw.myfocustext].value="1234";
}
</script>
</html>
解决方案 »
- 学完JavaScript可以做些什么实际的东西吖??
- 用JS从一个未知行列的table中娶到某列所以单元格中的值
- 怎样捕捉关闭当前面页时的事件?
- [求助]这个效果怎么实现?(多图滚动,按需载入)
- 请看下我这个简单的程序为什么无法执行?
- 求一个字符串抽取的正则表达式
- JSP能清楚window.history的内容么?
- 打开模态窗口后,再关闭,但整个父窗口焦点就回到了最上方,有办法停在原来的地方吗?
- javascript基础东东,请教下。
- 想提取文本框的值
- 如何做到,在一个窗口中点击一张表中的一行,关闭窗口,在另一个窗口的table添加。
- 怎样解决javascript下拉菜单在IE5和IE6中不兼容的问题,急急急!!!
就可以了
也就是说,我希望能够在任何页面上通过 showModelessDialog 调用h2.html。
用上述的方法可以实现。只是代码数量多了一点。 有否更好的方法......?