Bookmarklet: Generate a QR code for selected text

I wrote this bookmarklet to generate a QR code for any selected text in the web browser

javascript: function getQR() {
    var txt = '';
    if (window.getSelection) {
        txt = window.getSelection();
    }
    else if (document.getSelection) {
        txt = document.getSelection();
    }
    else if (document.selection) {
        txt = document.selection.createRange().text;
    }
    else return;
    if (txt == '') {
        alert('Select some text ');
        return;
    }
    void(window.open('http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl=' + encodeURIComponent(txt), 'Qr%20code', 'top=100,left=200,width=350,height=350,status=yes'));
}
void getQR();

Aim is to save a lot of typing on cramped mobile keyboards.

Inspiration for this.

NB: I have tested this on Firefox & it works nicely for moderate amounts of text. But since I am not a javascript programmer, pliss escuse any bugs.