javascript - Call function from child frame running program -


bear me. take little explaining.

i have main page divided 3 <divs> top <div> has hyperlink in it. 1 of other <divs> (called "menu_div") has <object> in loads perl script. default, hidden

when hyperlink clicked within "header_div", makes "menu_div" visible via "parent.document.getlementbyid('menu_div).style.visibility='visible'" @ same time, sets "show_hide" flag 1

if user clicks on hyperlink again, checks status of "show_hide", , if set 1, hides <div> , sets flag 0.

** in effect, each time user clicks hyperlink, box toggles on , off

with box open, , running script, goes till final part. can hide box again using visibility statement above. however, <header_div> containing hyperlink still set "show_hide flag @ "1", (to popup window open)

** - once menu.pl script has closed window, if hyperlink clicked again, nothing happens (as it's resetting "show_hide" flag) on second click, "menu_div" pops again. need change "show_hide" 0 before program submits form pop on first click of hyperlink next time.

note: when "menu_div" closes, sends data "menu.pl", , results displayed within "page_div"

what i'm asking ....

how show_options function before program makes submit call

that's explaination: here code

<link href="/style.css" rel="stylesheet" type="text/css">  <body>  <div class="header_div"> <object width="100%" height="30px" id="header" name="header" data="/cgi-bin/header.pl"></object>  </div> <div class="page_div" id="page_div"> <object id="page" name="page" width="100%" height="100%" data="/cgi-bin/page.pl"></object> </div> <div class="menu_div" id="menu_div"> <object id="menu" data="/cgi-bin/menu.pl" width="250px" height="150px"></object> </div> </body> 

+++++

within "header.pl"

<script language="javascript"> var show_hide=0; function show_options(){     if (show_hide == 0){     parent.document.getelementbyid('menu_div').style.visibility='visible';     show_hide=1;     return false;     }     if (show_hide == 1){     parent.document.getelementbyid('menu_div').style.visibility='hidden';     show_hide=0;     return false;     } } </script> <link href="/style.css" rel="stylesheet" type="text/css"> </head> <body topmargin="0" leftmargin="0" bgcolor="#eeaabb"> <table class="header_options"> <tr> <td width="300px"><font class="head">my site logo</font></td> <td width="100px"><font class="head"> <a href="javascript:void(0);" onclick="return show_options();">search</a></font></td> 

+++++

within "menu.pl" (abrreviated script)

function checkservice(){ var opt1=document.getelementbyid('service').selectedindex;     if (opt1 == 0){     return false;     } \\window.parent.show_options(); \\-- i'm getting probs \\parent.document.show_options(); \\parent.document.show_hide.value=0; \\parent.document.getelementbyid('menu_div').style.visibility='hidden'; \\ -- hide menu_div  document.userchoice.target="page"; document.userchoice.submit();  <select onchange="check_service();"> ... .. . </select> 

seems "taking hammer crack walnut" !! had - rather set "show_hide" flag - check status of . in otherwords, if visible or not. (interestingly, not work when checking 'hide' attribute, why i've used "not equal to" conditioner)

if (parent.document.getelementbyid('menu_div').style.visibility == "visible"){ parent.document.getelementbyid('menu_div').style.visibility='hidden'; return false; } if (parent.document.getelementbyid('menu_div').style.visibility != "visible"){ parent.document.getelementbyid('menu_div').style.visibility='visible'; return false; } 

now toggles on , off clicking hyperlink, hides when submit form, , opens instantly again when hyperlink clicked again.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -