1. Determine whether the IFRAME has been loaded
The page in IFRAME needs to be controlled during the page process! However, because the IFRAME page is completed by others, you only know some of its variables! The page structure is as follows: < MW: splitterpanel ID = "Detailsplitterpanel" Runat = "Server" >
< IFRAME ID = "Clxx" Style = "Margin: 5px 5px 5px; Height: 100%; width: 100%" Frameborder = 0 Scrolling = "No" Allowtransparency = "True" > </ IFRAME >
</ MW: splitterpanel >
This is if you directly document in the onload event of the parent page. frames ["clxx" 2.16.doc ument. getelementbyid ("splitter_splitter "). style. display = "NONE", ie will prompt an error. This is because IFRAME has not been loaded. In this case, directly referencing the variable does not exist, so you must use readystate and setTimeout () to achieve this goal together Function Setsplittervisiblity ()
{
If (Window. Frames [ " Clxx " Pai.doc ument. readystate = " Complete " )
Document. Frames [ " Clxx " Pai.doc ument. getelementbyid ( " Splitter_splitter " ). Style. Display = " None " ;
Else
SetTimeout ( " Setsplittervisiblity () " , 1000 );
}
Window. attachevent ( " Onload " , Function ()
{
Document. Frames [ " Clxx " ]. Location. href = $ Mappath ( " ~ /Blankwebview. aspx? Webview = bdtv1view & menuid = 02e141cc-720d-4986-9fc4-82a17cece41f " );
Setsplittervisiblity ();
} );
2. Obtain the dynamic parameter information of a function.
During the development process, function Overloading is often required. Javascript itself does not provide this function, but we can dynamically determine the number of functions to implement the same function to handle different problems.
For example, during the table loading process, the process is exactly the same before and after the table is filled in. The only difference is that the innertext value needs to be set for loading the table after the table is filled in, in this case, you can use the arguments attribute of the function to complete this task.Function Addbxbj (ARR)
{
If (Addbxbj. Arguments. Length = 0 )
{
Arr= NewArray ("",0,0,"");
}
VaR TGT = Document. getelementbyid ( " Bxbj_details " );
// Name
VaR Row = TGT. insertrow ();
VaR Cell = Row. insertcell ();
VaR OBJ = Createinputtext ( 150 );
OBJ. Value = Arr [ 0 ];
Cell. appendchild (OBJ );
OBJ. Focus ();
// Valuation
Cell = Row. insertcell ();
OBJ = Createinputtext ( 60 );
OBJ. Value = Arr [ 1 ];
Cell. appendchild (OBJ );
// Actual price
Cell = Row. insertcell ();
OBJ = Createinputtext ( 60 );
OBJ. Value = Arr [ 2 ];
Cell. appendchild (OBJ );
// Delete
Cell = Row. insertcell ();
OBJ = Document. createelement ( " Label " );
OBJ. innertext = " Add " ;
Cell. appendchild (OBJ );
OBJ. onclick = Addbxbj;
OBJ = Document. createelement ( " Label " );
OBJ. innertext = " Delete " ;
OBJ. onclick = Delselectedrow;
Cell. appendchild (OBJ );
}
3. Get the parameter value from the URL
Function Geturlparam (paramname)
{
VaR Oregex = New Regexp ( ' [\? &] ' + Paramname + ' = ([^ &] +) ' , ' I ' );
VaR Omatch = Oregex.exe C (window. Location. Search );
If (Omatch && Omatch. Length > 1 )
Return Omatch [ 1 ];
Else
Return '' ;
}
4. Bind parameters to the event
Code
// Statement on function prototype bind method
Function. Prototype. Bind = Function ()
{
VaR _ Method = This ;
VaR ARG = Arguments;
Return Function ()
{
_ Method. Apply (window, ARG );
}
}