web相关的学习,包括:
- JavaScript
- HTML/5+CSS
- PHP
HTML/CSS/JS学习笔记
先将你的 html 转换成 js 的形式,在线转换网站:http://www.css88.com/tool/html2js/
转好之后自定义个 xx.js 文件中写 var header = 你转好的内容
。
然后在 a.html 中首先引用 xx.js 文件,在 a.html 要用到的地方写上
<script type="text/javascript">
window.onload=function(){
document.write(header);
}
</script>
这样就可以将一个网站的头尾分离出来了。
出自:https://www.w3schools.com/howto/howto_html_include.asp
1.要引入的 html 文件:content.html
<a href="howto_google_maps.asp">Google Maps</a><br>
<a href="howto_css_animate_buttons.asp">Animated Buttons</a><br>
<a href="howto_css_modals.asp">Modal Boxes</a><br>
<a href="howto_js_animate.asp">Animations</a><br>
<a href="howto_js_progressbar.asp">Progress Bars</a><br>
<a href="howto_css_dropdown.asp">Hover Dropdowns</a><br>
<a href="howto_js_dropdown.asp">Click Dropdowns</a><br>
<a href="howto_css_table_responsive.asp">Responsive Tables</a><br>
2.在要引入的页面加入 <div w3-include-html="content.html"></div>
3.定义一个 js 文件,并且将其引入:
function includeHTML() {
var z, i, elmnt, file, xhttp;
/*loop through a collection of all HTML elements:*/
z = document.getElementsByTagName("*");
for (i = 0; i < z.length; i++) {
elmnt = z[i];
/*search for elements with a certain atrribute:*/
file = elmnt.getAttribute("w3-include-html");
if (file) {
/*make an HTTP request using the attribute value as the file name:*/
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {elmnt.innerHTML = this.responseText;}
if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
/*remove the attribute, and call this function once more:*/
elmnt.removeAttribute("w3-include-html");
includeHTML();
}
}
xhttp.open("GET", file, true);
xhttp.send();
/*exit the function:*/
return;
}
}
}
4.在要引入文件的页面调用这个方法:
<script>
includeHTML();
</script>
相当于是发了一个异步请求~
npm 国内的速度真是慢到令人发指...
开 ss 全局还没用,手动设置 npm 的代理试试
npm config set strict-ssl false
npm config set proxy=http://127.0.0.1:1080
npm config set https-proxy http://127.0.0.1:1080
npm config set registry "http://registry.npmjs.org/"
最后你可以删除这些配置:
npm config delete http-proxy
npm config delete https-proxy
当然,为什么不直接用 cnpm 呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.