SomethingToChatWith Posted March 7, 2011 Share Posted March 7, 2011 This look wrong to anyone? I want to get dynamic qr code generation working for every page on my blog. I desire to add it as a html/javascript gadeget on the side bar. My html/javascript experience is very limited.... Quote Link to comment Share on other sites More sharing options...
buffy Posted March 7, 2011 Share Posted March 7, 2011 (edited) Dang I cant copy and paste your code to edit it. <img height='240' width='240' id='qrimage' /> <script type='text/javascript'> document.getElementById('qrimage').src='***enter new image src here***'; </script> I don't fully understand what your trying to do but unless the src ends .jpg, .png, gif .... etc you wont get an image. Edited March 7, 2011 by buffy Quote Link to comment Share on other sites More sharing options...
digip Posted March 8, 2011 Share Posted March 8, 2011 (edited) Dang I cant copy and paste your code to edit it. <img height='240' width='240' id='qrimage' /> <script type='text/javascript'> document.getElementById('qrimage').src='***enter new image src here***'; </script> I don't fully understand what your trying to do but unless the src ends .jpg, .png, gif .... etc you wont get an image. When used on your site, it grabs the URL its placed on, then adds it to the string. Then google spits out a QR code image that when scanned with a phone with the QR plugin, it will load the websites address or whatever text info is in the QR code message. If you need to make one, try http://createqrcode.appspot.com/ And an image does not have to end in jpg, png or gif to display properly. For example - http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl=Hello%20World&chld=H|0 is an image, just can't post it here because the forums don't allow extraneous code in the image url for security reasons. by the way, the code in the first post, has the image tag inside of the script. You need to reference the script in the image tag as a src="javascript:somescriptThingy();" and then in the script, have it change the image for you on the fly. Edited March 8, 2011 by digip Quote Link to comment Share on other sites More sharing options...
SomethingToChatWith Posted March 9, 2011 Author Share Posted March 9, 2011 (edited) by the way, the code in the first post, has the image tag inside of the script. You need to reference the script in the image tag as a src="javascript:somescriptThingy();" and then in the script, have it change the image for you on the fly. So the updated code would be? Sorry, like I said I don't know a lot of html beyond basic tags. I got this code from 1 of the various blog posts on it if you do some Googling. The original post I had found was for getting it to work on a WordPress blog (which Lifehacker pointed out recently), but seeing as this is using Google's service I thought it would be easy enough to implement into a Blogger blog... but nope, it doesn't display anything right now. BTW, heres the code in text form: <script type='text/javascript'> <img height="240" id="QRImage" width="240" /> $("#QRImage").attr("src", "http://chart.apis.google.com/chart?cht=qr&chl=" + location.href + "&chs=240x240"); </script> Edited March 9, 2011 by JustinW Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.