1. glyphicon (圖示)
<a href="#" class="btn btn-info btn-lg">
<span class="glyphicon glyphicon-asterisk"></span> Asterisk
</a>
ref 1
try {
if(x == "") throw "empty";
if(isNaN(x)) throw "not a number";
x = Number(x);
if(x < 5) throw "too low";
if(x > 10) throw "too high";
}
catch(err) {
message.innerHTML = "Input is " + err;
}
$.ajax({ type: 'POST', url: url, data: data, dataType: dataType, success: function(response) {...}, error: function(jqXHR, textStatus, errorThrown) {...}, });
$.post("demo_test_post.asp",
{
name: "Donald Duck111",
city: "Duckburg"
},
function(data,status){
alert("Data: " + data + "\nStatus: " + status);
});
});
var parsedJson = $.parseJSON(jsonToBeParsed);
ref 1function IsJsonString(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
1 | < div style = "width:300px;height:250px;overflow:auto;" > |
2 | 您要輸入的內容 |
3 | </ div > |
function convert(str) { str = str.replace(/&/g, "&"); str = str.replace(/>/g, ">"); str = str.replace(/</g, "<"); str = str.replace(/"/g, """); str = str.replace(/'/g, "'"); return str; }
$( "p" ).removeClass( "myClass noClass" ).addClass( "yourClass" );
if (typeof(myVariable) != "undefined")
if (myVariable) //This throws an error if undefined. Should this be in Try/Catch?
ref 1var nf = new Intl.NumberFormat();
nf.format(number); // "1,234,567,890"
console.log(/^.+\/\d+,.+$/.test('1abc/24,abc'))
var myString = "something format_abc"; var arr = myString.match(/\bformat_(.*?)\b/); console.log(arr[0] + " " + arr[1]);
if (/*Condition to redirect*/){
//You need to redirect
header("Location: http://www.yourwebsite.com/user.php"); /* Redirect browser */
exit();
}
else{
// do some
}
AddType application/x-httpd-php .html .htm