Created
July 26, 2010 15:38
-
-
Save jrpz/490713 to your computer and use it in GitHub Desktop.
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
<div id="bib"> | |
<span id="title">Title</span> | |
<span id="author">Author</span> | |
<div id="location">Location</div> | |
</div> | |
<div id="qr_code"></div> | |
<script> | |
/* Grab bib info */ | |
var title = document.getElementById('title').innerHTML; | |
var author = document.getElementById('author').innerHTML; | |
var location = document.getElementById('location').innerHTML; | |
/* Set the contents of your QR code */ | |
var qr_content = 'T: ' + title + ' A: ' + author + ' Loc: ' + location; | |
/* Set url and parameters for Google Chart API */ | |
var api_url = 'http://chart.apis.google.com/chart'; | |
var cht = 'qr'; /* Chart Type */ | |
var chs = '300x300'; /* Chart Size */ | |
var chl = qr_content; /* Contents */ | |
var qr_img_url = api_url + '?cht=' + cht '&chs=' + chs + '&chl=' + chl; | |
/* | |
Save time by setting the api_url to the following: | |
'http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl=' | |
Then append your qr_content. | |
*/ | |
/* Add the image tag into your qr_code div tag */ | |
document.getElementById('qr_code').innerHTML = '<img src="' + qr_img_url + '" />'; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment