Example: There is no class data when a student is added. You need to automatically jump to the class display page.
Problem: students, classes, and other data are stored in the jsp file of iframe. The student management button is in the menu bar of main.html.
Solution:
Find the class management tag of the parent form by id <a>, and click
Copy codeThe Code is as follows:
Vertex (window.parent.doc ument). find ("# folder_12"). click ();
Later, the menu bar is changed to dynamic, and the menu id is also dynamic.
You want to get <a> through url and click.
Copy codeThe Code is as follows:
<A id = "folder_14" onClick = "removeTopMenuCss (); switchFolder (this. id); changeContent ('classmanager/classList. do ', this); "onFocus =" this. blur () "href =" javascript: void (0); "target =" mainFrame "> class management </a>
The value to be obtained is the changeContent ('url parameter') of The onClick method ')
View the Code directly:
Copy codeThe Code is as follows:
// Lele.info (subject (window.parent.doc ument). find (""));
Vertex (window.parent.doc ument). find ("# OutFolder a"). each (function (index, domEle ){
// Var s = $ (domEle). attr ("onclick") + "";
// Var start = s. indexOf (''classmanager/classList. do ');
Var str = domEle. attributes. onclick. value; // use js to obtain the onclick attribute value and search for the url
Var start = str. indexOf (''classmanager/classList. do ');
If (start> 0 ){
$ (DomEle). click ();
}
});
Summary: I used jquery to find the method and get the onclick attribute. I used indexOf to report an error and added a space to convert it to string.