This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function htmlEscape(str) { | |
return String(str) | |
.replace(/&/g, '&') | |
.replace(/"/g, '"') | |
.replace(/'/g, ''') | |
.replace(/</g, '<') | |
.replace(/>/g, '>'); | |
} | |
function htmlUnescape(value){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function view() { | |
var f = document.getElementById("file").files[0]; | |
var reader = new FileReader(); | |
reader.onload = (function(evt) { //evt get all value | |
document.getElementById('div').innerHTML = | |
"PIC :<img src=" + | |
evt.target.result + "/>" ; | |
}); | |
reader.readAsDataURL(f); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setSelectionRange(input, selectionStart, selectionEnd) { | |
if (input.setSelectionRange) { | |
input.focus(); | |
input.setSelectionRange(selectionStart, selectionEnd); | |
} | |
else if (input.createTextRange) { | |
var range = input.createTextRange(); | |
range.collapse(true); | |
range.moveEnd('character', selectionEnd); | |
range.moveStart('character', selectionStart); |