調用網址:https://chart.googleapis.com/chart?cht=qr
這邊寫一個簡單的範例,將網址轉換成 QRCode
window.open("https://chart.googleapis.com/chart?cht=qr&chs=120x120&choe=UTF-8&chld=H|0&chl=" + location.href)
轉至:http://knowlet3389.blogspot.tw/2013/08/js-google-api-qrcode.html
調用網址:https://chart.googleapis.com/chart?cht=qr
window.open("https://chart.googleapis.com/chart?cht=qr&chs=120x120&choe=UTF-8&chld=H|0&chl=" + location.href)
You can use your coins to buy refreshments at the little machine for life or melt the coins to make computers, that’s not my problem, I already paid them and fulfilled the law. A total of 20 billion coins, delivery hope to finish this week.
你可以用你的硬幣去買飲料在機器上過一生,或者燒掉硬幣去製造電腦,這些都不是我的問題,我已經支付罰款並履行法律。總共有20億個硬幣,希望在這個周末可以完成移交
<!doctype html>The src attribute in the <script> element must point to a copy of jQuery. Download a copy of jQuery from the Downloading jQuery page and store the jquery.js file in the same directory as your HTML file.
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="jquery.js"></script>
<script>
// Your code goes here
</script>
</body>
</html>
window.onload = function() {Unfortunately, the code doesn't run until all images are finished downloading, including banner ads. To run code as soon as the document is ready to be manipulated, jQuery has a statement known as the ready event:
alert( "welcome" );
}
$( document ).ready(function() {For example, inside the ready event, you can add a click handler to the link:
// Your code here
});
$( document ).ready(function() {Save your HTML file and reload the test page in your browser. Clicking the link should now first display an alert pop-up, then continue with the default behavior of navigating to http://jquery.com.
$( "a" ).click(function( event ) {
alert( "Thanks for visiting!" );
});
});
$( document ).ready(function() {
$( "a" ).click(function( event ) {
alert( "As you can see, the link no longer took you to jquery.com" );
event.preventDefault();
});
});
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="jquery.js"></script>
<script>
$( document ).ready(function() {
$( "a" ).click(function( event ) {
alert( "The link will no longer take you to jquery.com" );
event.preventDefault();
});
});
</script>
</body>
</html>
<style>Next, add the addClass() call to the script:
a.test {
font-weight: bold;
}
</style>
$( "a" ).addClass( "test" );All a elements are now bold.
$( "a" ).removeClass( "test" );
$( "a" ).click(function( event ){then the link slowly disappears when clicked.
event.preventDefault();
$( this ).hide( "slow" );
});
$.get( "myhtmlpage.html", myCallBack );When $.get finishes getting the page myhtmlpage.html, it executes the myCallBack function. Note that the second parameter here is simply the function name (but not as a string and without parentheses).
$.get( "myhtmlpage.html", myCallBack( param1, param2 ) );The reason this fails is that the code executes myCallBack( param1, param2 ) immediately and then passes myCallBack's return value as the second parameter to $.get. We actually want to pass the function myCallBack, not myCallBack( param1, param2 )'s return value (which might or might not be a function). So, how to pass in myCallBack and include its arguments?
$.get( "myhtmlpage.html", function() {When $.get finishes getting the page myhtmlpage.html, it executes the anonymous function, which executes myCallBack( param1, param2 ).
myCallBack( param1, param2 );
});
$( "button.continue" ).html( "Next Step..." )
var hiddenBox = $( "#banner-message" );
$( "#button-container button" ).on( "click", function( event ) {
hiddenBox.show();
});
$.ajax({
url: "/api/getWeather",
data: {
zipcode: 97201
},
success: function( data ) {
$( "#weather-temp" ).html( "<strong>" + data + "</strong> degrees" );
}
});