Skip to main content
ExLibris

Knowledge Assistant

BETA
 
  • Subscribe by RSS
  • Back
    Aleph

     

    Ex Libris Knowledge Center
    1. Search site
      Go back to previous article
      1. Sign in
        • Sign in
        • Forgot password
    1. Home
    2. Aleph
    3. Knowledge Articles
    4. Using placeholder variables in javascript

    Using placeholder variables in javascript

    1. Last updated
    2. Save as PDF
    3. Share
      1. Share
      2. Tweet
      3. Share
    No headers
    • Article Type: General
    • Product: Aleph
    • Product Version: 18.01

    Description:
    We would like to use some of the placeholder variables (e.g. $0100, $0200) in javascript functions. Simple assignments don't seem to be working reliably. Has anyone hit on a technique for using those variables in javascript?

    Resolution:
    The technique we're using is to put the variable, by itself, inside an HTML element (like a "<div>") that has a unique ID, and then reference the ".innerHTML" property of the element in order to use the value in javascript. E.g.:
    ----------
    <div id="divHOL1">
    $0100
    </div>
    <script type="text/javascript">
    sVar = document.getElementById("divHOL1").innerHTML;
    </script>
    ---------
    This avoids the problem of javascript seeing single/double quotation marks inside the Aleph variable and chopping off the string.

    In practice, we also usually have to use javascript to output the HTML element itself, because re-using an "id" tag (on screens where the same Aleph variable gets output multiple times with different values, which is a lot of screens) will cause the "getElementById" function to fail in Internet Explorer (works in Firefox).

    So, the example above becomes (where the "iHolIdx" variable has been initialized and incremented elsewhere):
    ---------
    <script text="text/javascript">
    document.write('<div ID="divHOL'+iHolIdx+'">');
    </script>
    $0100
    </div>
    <script text="text/javascript">
    sVar = document.getElementById("divHOL"+iHolIdx).innerHTML;
    </script>
    ---------

    Thanks to Kerry Bouchard, Texas Christian University for posting this information to the ELUNA-PUB-INTERFACE-IG-L list.


    • Article last edited: 10/8/2013
    View article in the Exlibris Knowledge Center
    1. Back to top
      • Using Oracle Data Pump on live production server
      • Using PLIF to populate z303_ill_library
    • Was this article helpful?

    Recommended articles

    1. Article type
      Topic
      Language
      English
      Product
      Aleph
    2. Tags
      1. 18.01
      2. contype:kba
      3. Prod:Aleph
      4. Type:General
    1. © Copyright 2025 Ex Libris Knowledge Center
    2. Powered by CXone Expert ®
    • Term of Use
    • Privacy Policy
    • Contact Us
    2025 Ex Libris. All rights reserved