Home > front end >  Pray god to help modify the js code, thank you very much!!!!!!!!!!
Pray god to help modify the js code, thank you very much!!!!!!!!!!

Time:05-15

Pray god to help modify the js code, in order to realize the function of the is:
Selection in the list of li1 to achieve
http://search.chinalaw.gov.cn/SearchLawTitle? EffectLevel=& amp; SiteID=124 & amp; Query="input keywords"
Search
Selection in the list of li2 to achieve
http://std.samr.gov.cn/search/std? Q="input keywords"
Search
Li3 selection list to achieve
http://www.sxpc.gov.cn/sxsrdsearch/search.jsp? Sword="input keywords"
Search

The first search can be done now, how to realize the second, third search,



<meta HTTP - equiv="content-type" Content="text/HTML. Charset=utf-8 "& gt;
<meta name="viewport" content="width=device - width, initial - scale=1.0" & gt;
<meta HTTP - equiv="X - UA - Compatible" content="IE=edge" & gt;

<body>









<script SRC="https://bbs.csdn.net/topics/js/jquery.min.js" & gt; </script>
<script>
$(function () {
$(". Select_box "). Click (function (event) {
Event. StopPropagation ();
$(this). The find (" option "). Toggle ();
$(this). The parent (s). The siblings (.), find (" option "). Hide ();
});
The $(document). Click (function (event) {
Var eo=$(event. Target);
If ($(". Select_box ") is (" : the visible ") & amp; & Eo. Attr (" class ")!="option" & amp; & ! Eo. The parent (" option "). The length)
$(' option '). Hide ();
});
$(" option li "). Click (function () {
Var check_value=https://bbs.csdn.net/topics/$(this). The text ();
Var zlValue=https://bbs.csdn.net/topics/$(' option li: eq (1) '). The HTML ();
Var bqValue=https://bbs.csdn.net/topics/$(' option li: eq. (2) '). The HTML ();
Var searchPlaceholder=document. GetElementById (" searchPlaceholder "). The value;
$(this). The parent (s). The siblings (". Select_txt "). The text (check_value);
$(" # select_value "). Val (check_value);
If (check_value=zlValue https://bbs.csdn.net/topics/={
$(' # searchPlaceholder). Prop (' placeholder ', 'please enter the industry standard keyword');

{} else if (check_value=https://bbs.csdn.net/topics/=bqValue)
$(' # searchPlaceholder). Prop (' placeholder ', 'please enter local laws keyword');

} else {
$(' # searchPlaceholder). Prop (' placeholder ', 'please enter the keyword' laws and regulations);

}
});
})
</script>
<script>
$(function () {
//ie compatibility strategy
If (typeof String. Prototype. StartsWith!=='function') {
String. The prototype. The startsWith=function (prefix) {
Return this. Slice (0, the prefix length)===the prefix;
};
}
If (typeof String. Prototype. EndsWith!=='function') {
String. The prototype. EndsWith=function (suffix) {
Return this. IndexOf (suffix, enclosing length - suffix. Length).==1;
};
}
})
The function tabclick (db) {
Var url="? TAB="+ db +" & amp; SiteCode=14000000450 ";
The location. The href=https://bbs.csdn.net/topics/url;
}
The function outsite (url) {
Window. The open (url, "_blank")
}
The function gosearch () {
Var qt=document. GetElementById (" qt "). The value;
If (qt==null | | qt=="") {
Alert (" please enter a keyword to search ");
} else {
Var url="http://search.chinalaw.gov.cn/SearchLawTitle? EffectLevel=& amp; SiteID=124 & amp; Query="+ encodeURIComponent (qt);
Window. The open (url, "_blank")
}
}
The function hot (word) {
Var url="s? TAB=all& SiteCode=14000000450 & amp; Qt="+ encodeURIComponent (word);
Window. The open (getHref () + url, "love")
}
The function keySearch () {
Var evt=window. The event | | e;
If (evt) keyCode==13) {
Gosearch ()
}
}
The function getHref () {
Var href=https://bbs.csdn.net/topics/location.href;
If (href. IndexOf ('? ')!=1) {
Href=https://bbs.csdn.net/topics/href.substring (0, href. LastIndexOf ('? '))
}
if (! Href. EndsWith ('/') {
Href +='/'
}
Return the href;
}
$(function () {
//ie compatibility strategy
If (typeof String. Prototype. StartsWith!=='function') {
String. The prototype. The startsWith=function (prefix) {
Return this. Slice (0, the prefix length)===the prefix;
};
}
If (typeof String. Prototype. EndsWith!=='function') {
String. The prototype. EndsWith=function (suffix) {
Return this. IndexOf (suffix, enclosing length - suffix. Length).==1;
};
}
})
</script>

CodePudding user response:

As you say, you are ready to the first, the two is not change the address?
Three sites in an array, what kind of search is first gets the current index (li), and then the corresponding url from an array, good spelling of your keywords, the window. The open ()
nullnull
  • Related