hot wire !! hot wire !!
The page Jump is fully automated
Let me help you free your hands
You don't have to click by yourself ~
Our study is to make the code more concise and the effect better !
Let's start now ~
Our needs :
When clicked “ Sign in ” perhaps “ register ” Can jump to the page we want :
such as , When clicked “ Sign in ”
Jump to the login page :
When clicked “ register ”
Jump to the registration page :
stay HTML The code is as follows :
<ul> <li> <a href="javascript:;" value=" Sign in " id="denglu" class="dl"> Sign in </a>
<!-- id='denglu' It is used to judge whether the last obtained value is --> </li> <li> <a href="javascript:;"
value=" Sign in " id="logon" class="zc"> register </a> </li> </ul>
stay JavaScript The code is as follows :
function load11() { // With a function “ Sign in ” encapsulation var parm1 =
document.getElementById('denglu').id; var myurl = 'load.html' + '?' + 'parm1='
+ parm1; //myurl This variable is used to load the jump page load.html And in the login link id value
window.location.assign(myurl); } function logon11() { // With a function “ register ” encapsulation var parm2
= document.getElementById('logon').id; var myurl = 'load.html' + '?' + 'parm2='
+ parm2; window.location.assign(myurl); } // Register a click event , When you click this login word, you can call the function to jump var dl
= document.querySelector('.dl'); dl.addEventListener('click', function() {
load11(); }) var zc = document.querySelector('.zc');
zc.addEventListener('click', function() { logon11(); })
When you jump to the login interface Javascript The code inside :
var suibian = null; getparm(); function getparm() { var url = location.href;
console.log(url + '21111'); var tmp1 = url.split('?')[1]; console.log(tmp1);
var tmp2 = tmp1.split('%')[0]; console.log(tmp2); var tmp3 =
tmp2.split('=')[1]; console.log(tmp3); suibian = tmp3;
// The above steps are the final results obtained by decomposing the website in the page that jumps over id name } if (suibian == 'denglu') {
row1[0].style.display = 'block'; lis[1].className = ''; row1[1].style.display =
'none'; } else { lis[0].className = ''; row1[0].style.display = 'none';
lis[1].className = 'current'; row1[1].style.display = 'block'; }
The above is all the code snippets , The required code can be accessed by yourself !
Technology
Daily Recommendation