Help with Bookmarklet

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Giles

    #1

    Help with Bookmarklet

    I'm modifying some bookmarklets that get into our Library Catalog to
    work with Firefox, based on some that work done at another library with
    our same system. The bookmarklets they setup work fine in IE.

    So far I've been able to get all the ones that prompt for a
    single variable to work perfectly in Firefox.

    The Author-Title one, however, prompts for TWO variables and it
    works EXCEPT for the fact that the boxes for Author and Title
    contain the word "undefined" rather than being simply blank boxes
    (as as the ones with the single variable).

    How do I get the boxes to be blank here as well? I tried several
    different things but none worked.

    Here's the code:

    <a href="javascrip t:Qr=document.g etSelection.tex t;Qa=prompt
    ('Author...',Qr );Qt=prompt('Ti tle...',Qr);
    if(Qa&&Qt)locat ion.href='http://library.ccbcmd. edu/search~S4/q?
    author='+escape (Qa)+'&title='+ escape(Qt)">
    Combined Author and Title...</a>

    Thanks in advance for any help you can provide.

    Giles W. Riesner Jr., Library Tech Support
    Community College of Balto. Co. - Catonsville
    800 S. Rolling Rd., Baltimore MD 21228 USA
    Tel/V-Mail 1-410-455-4245
    Email: griesner@ccbcmd .edu

  • Martin Honnen

    #2
    Re: Help with Bookmarklet



    Giles wrote:

    [color=blue]
    > The Author-Title one, however, prompts for TWO variables and it
    > works EXCEPT for the fact that the boxes for Author and Title
    > contain the word "undefined" rather than being simply blank boxes
    > (as as the ones with the single variable).
    >[/color]
    [color=blue]
    > <a href="javascrip t:Qr=document.g etSelection.tex t;Qa=prompt
    > ('Author...',Qr );[/color]

    You want
    var Qr = document.getSel ection(); var Qa = prompt('Author. ..', Qr);
    at least for Netscape 4 and later, and for Opera 7.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Spats30

      #3
      Re: Help with Bookmarklet

      Qr=document.get Selection.text is an incorrect statement. Thus the
      variable goes "undefined"

      Comment

      • Giles

        #4
        Re: Help with Bookmarklet

        Thanks. I tried what you gave me and it works beautifully.
        Thanks Spats30 for your information as well.

        --Giles Riesner

        Comment

        Working...