📄 clientsi.js
字号:
/** Licensed to the Apache Software Foundation (ASF) under one or more* contributor license agreements. The ASF licenses this file to You* under the Apache License, Version 2.0 (the "License"); you may not* use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License. For additional information regarding* copyright in this work, please see the NOTICE file in the top level* directory of this distribution.*/// global vars for access from callback functionvar req = false;var element;function clientSideInclude(id, url) { // For Safari, Firefox, and other non-MS browsers if (window.XMLHttpRequest) { try { req = new XMLHttpRequest(); } catch (e) { req = false; } } else if (window.ActiveXObject) { // For Internet Explorer on Windows try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { req = false; } } } // var element = document.getElementById(id); element = document.getElementById(id); if (!element) { alert("Bad id " + id + "passed to clientSideInclude." + "You need a div or span element " + "with this id in your page."); return; } if (req) { // Asynchronous request using processReqChange callback req.onreadystatechange = processReqChange; req.open('GET', url, true); req.send(null); }}// handle onreadystatechange event of req objectfunction processReqChange() { // only if req shows "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { element.innerHTML = req.responseText; } else { alert("There was a problem retrieving the XML data:\n" + req.statusText); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -