Skip to content

Instantly share code, notes, and snippets.

@ColinMichaels
Created June 12, 2011 02:51
Show Gist options
  • Save ColinMichaels/1021198 to your computer and use it in GitHub Desktop.
Save ColinMichaels/1021198 to your computer and use it in GitHub Desktop.
qrcode_gen
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="../css/jquery-ui-1.8.12.custom.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['imagechart']});
function drawVisualization(formData) {
var i;
for (i=0; i<formData.length; i++)
{
var chk = formData[i].value;
var fieldName = formData[i].name;
if(chk==null || chk=="" || chk=="http://")
{
alert("All fields under the INPUT AREA must be filled in. You left the "+ fieldName + " blank.");
return;
}
}
var options = {};
// Chart API chart type 'rs' is radar chart
options.cht = 'qr';
options.chl = formData.url.value;
options.chs = formData.size.value;
options.chld = formData.error.value;
dataTable = new google.visualization.DataTable();
var chart = new google.visualization.ImageChart(document.getElementById('visualization'));
chart.draw(dataTable, options);
}
// google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body>
<div id="visualization"></div>
<form id="myform" action="">
URL <input type="text" name="url" value="http://" size="30"/>
<br />
SIZE<select id="size" name="size">
<option value="340x340">340x340</option>
<option value="300x300">300x300</option>
<option value="200x200">200x200</option>
<option value="100x100">100x100</option>
</select>
<br />
QR ERROR Correction Level
<select id="error" name="error">
<option value="L">7%</option>
<option value="M">15%</option>
<option value="Q">25%</option>
<option value="H">30%</option>
</select>
<br />
<input type="button" name="submit" value="Submit" onclick="drawVisualization(this.form)"/>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment