Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback on: irt.org FAQ Knowledge Base Q73, January 10, 2000 at 09:09:49:

You are here: irt.org | About | Feedback | 717 [ previous next ]

Feedback on:
irt.org FAQ Knowledge Base Q73

Sent by
Steve Nabors on January 10, 2000 at 09:09:49:

Worth:
Very worth reading

Comments:
I'm getting e-mailed on the comment above so here is a working example:

In your frame page, make FrameA and FrameB the frame names.
Html for framer page below:

<html><head></head>
<frameset rows="20%,*">
<frame SRC="framea.htm" name="FrameA" noresize>
<frame SRC="frameb.htm" name="FrameB" noresize>
<noframes>
<body>
</body>
</noframes>
</frameset>
</html>

Html for framea.htm page below:

<html><head><script>
function printotherframe()
{
parent.FrameB.formB.textboxb.focus()
parent.FrameB.formB.submit()
}
</script></head>
<body>
<form name="formA"><input type="button" value="Print the other frame" onclick="printotherframe()">
</body></html>

Html for frameb.htm page below:

<html><head>
<SCRIPT LANGUAGE="JavaScript"></SCRIPT>


<SCRIPT LANGUAGE="VBScript">
sub window_onunload

on error resume next

' Just tidy up when we leave to be sure we aren't
' keeping instances of the web-browser control in memory
set WB = nothing
end sub

sub print

OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_PROMPTUSER = 1


on error resume next

'IE4 object has different command structure
if DA then
call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER)

else
call WB.IOleCommandTarget.Exec(OLECMDID_PRINT ,OLECMDEXECOPT_DONTPROMPTUSER,"","")

end if

if err.number <> 0 then
if DA then ' IE4 they probably cancelled
alert "Nothing Printed :" & err.number & " : " & err.description
else
handle_error ' ie3x give alternate instructions
end if
end if
end sub

'This will be interpreted during loading.
'It will write out the correct webbrowser object depending
'on the browser version. To be sure it works, make sure you
'include this script block in between the body tags.

if DA then
'this must be IE4 or greater
wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"
else
'this must be IE3.x
wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"
end if

document.write "<OBJECT ID=""WB"" WIDTH=0 HEIGHT=0 CLASSID=""CLSID:"
document.write wbvers & """> </OBJECT>"
</SCRIPT>

</head>
<body>
<form name="formB" action="javascript:window.print()">
<input type="text" name="textboxb" size="12" value="Print Me">
</form>
</body></html>



Other feedback on 'irt.org FAQ Knowledge Base Q73' - show all

©2018 Martin Webb