i'm not sure if your window.htm can access the variable via the reference myframe.myvar
what i would do, though, is to put in the value inside a hidden form widget (input type="hidden" name="whatever" />) and access the value via myframe.document.<formName>.whatever.value (or myframe.document.forms[0].whatever.value if you are sure that the hidden input widget is in the first form in the document)