recently in the Web site encountered a problem, need to get a different frame control, ask some colleagues, they say it is not available ,
Find a lot of information on the Internet, found a solution, now tidy up the original solution:
1. I need to control the display of a div control in the Leftframe in mainframe, as shown in:
2, directly in the mainframe through the document.getElementById (' Div1 ') to obtain, the results cannot be obtained;
3, since directly can not get, that I could first get all the controls in the Leftframe, try a bit, it is possible;
1 var iobj=parent.document.getelementbyid ('leftframe'). Contentwindow;
4, have already taken all the controls, then I take a div, is not very good to take, as follows;
1 iObj.document.getElementById ('divtiernotes'). style.display= ' None ';
5, so the problem is solved.
Full code:
1 js file:2 function Chktiernotedis (Strdis)3 {4 //compatible with all browsers5 varIobj=parent.document.getelementbyid ('Leftframe'). Contentwindow; 6IObj.document.getElementById ('Div1'). style.display=Strdis;7 }8 9 Backstage:Ten stringStrdis ="None"; OneClientscript.registerstartupscript ( This. GetType (),"Key","<script>chktiernotedis ('"+ Strdis +"');</script>");
ASP. NET get control in different frame