htm5 form javascript validation

http://www.sitepoint.com/html5-forms-javascript-constraint-validation-api/ 1. progressive enhancement: http://jsfiddle.net/trixta/ru7… http://jsfiddle.net/trixta/ru7jt/ http://stackoverflow.com/questions/12470622/how-can-i-check-the-validity-of-an-html5-form-that-does-not-contain-a-submit-but form.checkValidity() https://html.spec.whatwg.org/multipage/forms.html#dom-form-checkvalidity https://html.spec.whatwg.org/multipage/forms.html#statically-validate-the-constraints ===== var form = document.getElementById(“purchaser_form”); form.noValidate = true; form.onsubmit = validateForm; // set handler to validate the form // onsubmit used for easier cross-browser compatibility function validateForm(event) { if (form.checkValidity()) { return true; } else { field = form.querySelector(‘input:invalid, select:invalid, textarea:invalid’); field.focus(); if (field.checkValidity()) { removeInvalid(field); } else { setInvalid(field); } return false; } } function setInvalid(element) { var message; var parent = element.parentNode; ...

2016-03-31 · 1 min · 110 words · Me

php allpay 歐付寶

http://www.webteach.tw/?p=591 https://github.com/allpay/AllPayAioExample/blob/master/Allpay_AIO_CreateOrder.php

2016-03-29 · 1 min · 2 words · Me

shopping cart class

refrence http://codereview.stackexchange.com/questions/25671/my-perfect-shopping-cart-class Easy way is copy this code to your php editor. 1、const ID, QTY for column name, it’s can change by yourself. 2、session only check isset. 3、array_push_after() maybe use not good way. 4、$item from CartItemtoArray(), this is array(). not class object. 5、getIndexOfEntry() try to get Array $container at index. So use Array to control, no Object. Becasue I don’t know refrence, answer 1 and 2, How to create item add in cart. ID is key. Answer 1 can run, answer 2 is broken. ...

2016-03-23 · 3 min · 430 words · Me

PDO array Undefined offset Undefined index fetchAll(PDO::FETCH_ASSOC) fetch(PDO::FETCH_ASSOC)

When you use PDO, try to get fetchAll(PDO::FETCH_ASSOC) fetch(PDO::FETCH_ASSOC) return is Array. This Array have rows, it’s mean : array[0] = array[“field1”, “field2”, “field3”] array[1] = array[“field1”, “field2”, “field3”] …… array[10] = array[“field1”, “field2”, “field3”] So get array index or row maybe not exist, when you try to get value, get error code. You can try to make two function: function ar_get($val, $ar){ return array_key_exists($val, $ar)?$ar[$val]:""; } function crud_ar_get($val, $ar, $rec_arrow=0){ return (isset($ar[$rec_arrow]))?ar_get($val, $ar[$rec_arrow]) : “”; } ...

2016-03-18 · 1 min · 151 words · Me

Dell Latitude E6230 E6220

淘寶上有,最便宜大概五千,不要ram和hdd情況下,但12吋螢幕 http://www.mobile01.com/topicdetail.php?f=236&t=4740398

2016-03-18 · 1 min · 2 words · Me