Created
March 20, 2018 09:53
-
-
Save anonymous/34b87adbcc226ab6b358ca4026b6cd15 to your computer and use it in GitHub Desktop.
(source: https://jsfiddle.net/)
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Untitled</title> | |
</head> | |
<body> | |
<button>click me</button> | |
<div id="tableWrap"> | |
<table> | |
<thead> | |
<tr><th>A</th><th>B</th><th>C</th></tr> | |
</thead> | |
<tbody> | |
<tr><td>1</td><td>2</td><td>3</td></tr> | |
<tr><td>1</td><td>2</td><td>3</td></tr> | |
<tr><td>1</td><td>2</td><td>3</td></tr> | |
<tr><td>1</td><td>2</td><td>3</td></tr> | |
</tbody> | |
</table> | |
</div> | |
</body> | |
</html> |
This file contains hidden or 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(){ | |
$('button').click(function(){ | |
var url='data:application/vnd.ms-excel,' + encodeURIComponent($('#tableWrap').html()) | |
location.href=url | |
return false | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment