javascript - Ask for advice: How to display the originally hidden div of page 2 when linking from page 1 to page 2?
迷茫
迷茫 2017-07-05 10:54:05
0
2
800

Can it be done purely using js and html?
One way that comes to mind is to use the form on page one to pass parameters, and page two to judge the parameters to determine whether p is displayed.
But how are the parameters passed by action received by page 2?

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title></title>
    
</head>
<body>

<form action="index2.html#p">
<input type="text" name="firstname" value="">
<input type="submit" value="Submit">
</form> 

</body>
</html>

Please tell me, seniors, whether this method is feasible? How to do it?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
女神的闺蜜爱上我

Get url parameters


function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
 
// 调用方法
alert(GetQueryString("参数名1"));
alert(GetQueryString("参数名2"));
alert(GetQueryString("参数名3"));
刘奇

One more thing, CSS3’s :target pseudo-class selector can also implement this function, mainly using anchor points

Reference: http://css.doyoe.com/selector...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template