The page will often have a window, and some of the window is dynamically generated, and some of the window is hidden at the bottom of the page, for dynamically generated window, if you want to listen to the events of the window, you can use jquery event binding on () method implementation.
As shown in the picture, the window is JS dynamic generation, by clicking on a link popup, pop-up window in the "immediately to use" link clicked, the effect is to close the window, and jump to the anchor point.
This a label is:
Copy Code code as follows:
<a style= "Display: title=" immediately to use "target=" _blank "gid=" 167 "href=" http://act.vip.***.com/vip/2016/51dps/# Gamelist "class=" Co_vip TDU "> immediately to use </a>
We want to monitor the click event in the window, but the window itself is dynamically generated, so we have to listen to the body, through on () event binding, when dynamically generated this window, you can monitor the click Method:
function Jump_to_anchor () {
$ ("body"). On ("click", "Span[name= ' Msgbox_info '] a,. act-pop-table a", function (e) {
link = $ (this). attr (' href ');
if (link = = ' http://act.vip.***.com/vip/2016/51dps/#gamelist ') {
e.preventdefault ();
Msgexit ();
window.location.href = link;}}
);
This is actually a binding of two-a-tag event bindings, both when the link is a URL, blocks the default behavior, and calls the close window method to jump to the link, which is the anchor point.