Hide/Show layers with Javascript

Hello,
I am trying to find a Javascript method for hiding/showing layers in a pdf document. I would like to be able to use an if/else statement to set the visibility of multiple layers.
Let's say I have 5 layers on a single page, all set to hidden by default. This page also has a field with 5 options relating to each of the 5 layers. Once an option is selected, an if/else will use this method to set the appropriate layer to visible.
Thank you!

Here is another way to satisfy your layer requirements in PDF.
1. Create a Field (type: button) for each layer. Suppose the five “layers” are called “LayerButton1”, “LayerButton2”, “LayerButton3”, “LayerButton4”, and “LayerButton5” (using Acrobat Professional or using the doc.addField API).
2. Store an image for each layer (using Acrobat Professional or using the buttonSetIcon API).
3. Position each button on the page anywhere you want (using the rect property)
4. Each option that controls the visibility of a respective “layer” may also be a button. Create a Field (type: button) for each control.  Suppose the five “control buttons” are called “ToggleLayerButton1”, “ToggleLayerButton2”, “ToggleLayerButton3”, “ToggleLayerButton4”, and “ToggleLayerButton5”.
5. Position each control button on the page anywhere you want.
6. For ToggleLayerButton1, add the following MouseUp action (using Acrobat Professional or using the Field.setAction API):
  var fld = this.getField("Button1");
  if (fld.display == display.hidden)
    fld.display = display.visible;
  else
    fld.display = display.hidden;
7. Repeat the MouseUp action for the other control buttons.
I hope this helps. - john

Similar Messages

  • Jump Menu with Hide/Show Layers

    Is it possible to set up a jump menu or list menu where each
    item in the list controls layer visibility. Is it possible to
    assign Hide/Show Layers behavior to an item in a menu?

    You just need to do 2 things to make this happen. In the body
    of the HTML add the call JS function:
    quote:
    function MM_callJS(jsStr) { //v2.0
    return eval(jsStr)
    Then in the form that contains the menu instead of using the
    call to the Jump Menu script, use the call to the above script like
    so:
    quote:
    <select name="jumpMenu" id="jumpMenu"
    onchange="MM_callJS(jumpMenu.value)">
    And make sure to set the values equal to the
    MM_showHideLayers function for each menu item like this:
    quote:
    <option
    value="MM_showHideLayers('apDiv2','','show','apDiv3','','hide','apDiv4','','hide')">Compa ny
    A</option>
    I just tried it on a sample page, and it works fine.

  • How to keep display as Show when using Hide Show region with pagination?

    We are trying to use a 'Hide Show' region with pagination. The problem is that if you 'Show' (ie expand) the region and then hit the link for the next page, the next page displays Hidden (ie collapsed). We want to keep the page display as 'show' when you move to the next set of records.
    There is a fix in this forum for this issue in version 2.2 (Application Express) but we are on 2.0.0.00.49 (HTML DB). Does anyone know of a similar fix for HTML DB 2?
    Ver 2.2 fix is at:
    http://www.oracle.com/technology/products/database/application_express/packaged_apps/packaged_apps.html#STICKY
    Thanks.
    David.

    Thanks for your reply.
    Running the application install script via SQL Plus using FLOWS_020000 produces result:
    NOT COMPATIBLE (Your export may contain calls not supported by your HTMLDB version.)
    The wwv_flow_api package routines that are not available in our version appear to be:
    create_or_remove_file
    create_install
    create_install_script
    Is there any way to handle these calls in other ways?
    Thanks
    David.

  • Resize and hide a movie with JavaScript Fonctions

    Hello,
    I've read your topic about JavaScript Scripting Guide for QuickTime and I want to know if there is a solution for to rezise and to hide movie with JavaScript fonctions.
    Thank in advance

    It is very strange, most users who have focus on JS try to do everything with it, whereas lot of simple actions can easily be done with advanced/shared actions. I will only go to JS when it is not possible with advanced/shared actions.
    You are lucky, I was just restarting to work on an advanced training for next week when your question showed up.

  • How can I hide a button with javascript in Captivate 8?

    I need to run some javascript in my project and at the same time I want to hide a button, so I can't use advanced actions.

    It is very strange, most users who have focus on JS try to do everything with it, whereas lot of simple actions can easily be done with advanced/shared actions. I will only go to JS when it is not possible with advanced/shared actions.
    You are lucky, I was just restarting to work on an advanced training for next week when your question showed up.

  • Hide/Show layers during playback

    Hi, everyone
    I want to use a layer as a subtitle track, and I want to be
    able to show/hide it by clicking a button. Any tips?
    Thanks.
    Dan

    you can dynamically control layers during runtime - your
    timeline becomes flattened upon export -
    copy/paste contents of layer into a Movie Clip (MCs are
    dynamic and meant to be controlled via
    actionscript) and then set it's visability to true/false via
    a button during runtime.
    --> **Adobe Certified Expert**
    --> www.mudbubble.com
    --> www.keyframer.com
    aixamarquez wrote:
    > Hi, everyone
    >
    > I want to use a layer as a subtitle track, and I want to
    be able to show/hide it by clicking a button. Any tips?
    >
    > Thanks.
    >
    > Dan

  • Hide / Show Layers onLoad?

    Using a radio button group, I am determining if a client is
    using a transmission interval. (radio button's are not showing
    below).
    Use Transmission Interval: NO YES
    Depending on the choice made - I am displaying the applicable
    layer which contains other options. Here is the code for the radio
    buttons.
    <input type="radio" <!--(ckmtroc1)--> name="mtrocc"
    value="0"
    onClick="MM_showHideLayers('Layer1','','hide','Layer7','','show','Layer2','','hide','Laye r3','','hide','Layer4','','hide','Layer5','','hide','Layer6','','hide')">NO
    <input type="radio" <!--(ckmtroc2)--> name="mtrocc"
    value="1"
    onClick="MM_showHideLayers('Layer1','','show','Layer7','','hide','Layer2','','hide','Laye r3','','hide','Layer4','','hide','Layer5','','hide','Layer6','','hide')">YES
    The concept is working as the correct information is coming
    to our servers and visa versa...however...if a person wants to view
    or change the information the initial state of the page is that the
    correct button is selected, but the associated layer is not
    displaying onload.
    You have to reclick the radio button at each step because of
    the onClick function. We are able to determine if the button is
    selected and send the applicable instructions when the page is
    loaded (i.e. show or hide ... or ... change onClick to onLoad - but
    I can't get the behavior assigned to the radio button - and not
    sure if I am even using the correct behavior.
    If I am not explaining myself correctly - please advise and I
    will explain more.

    What about putting the MM_ShowHideLayers script in a function
    that
    determines the state of the radio button, and then using that
    function
    OnLoad and OnClick?
    "OllieGirl1" <[email protected]> wrote in
    message
    news:ea8dig$6mt$[email protected]..
    > Using a radio button group, I am determining if a client
    is using a
    > transmission interval. (radio button's are not showing
    below).
    >
    >
    Use Transmission Interval: NO YES
    >
    > Depending on the choice made - I am displaying the
    applicable layer which
    > contains other options. Here is the code for the radio
    buttons.
    >
    > <input type="radio" <!--(ckmtroc1)-->
    name="mtrocc" value="0"
    >
    onClick="MM_showHideLayers('Layer1','','hide','Layer7','','show','Layer2','','hi
    >
    de','Layer3','','hide','Layer4','','hide','Layer5','','hide','Layer6','','hide')
    > ">NO
    > <input type="radio" <!--(ckmtroc2)-->
    name="mtrocc" value="1"
    >
    onClick="MM_showHideLayers('Layer1','','show','Layer7','','hide','Layer2','','hi
    >
    de','Layer3','','hide','Layer4','','hide','Layer5','','hide','Layer6','','hide')
    > ">YES
    >
    > The concept is working as the correct information is
    coming to our servers
    > and
    > visa versa...however...if a person wants to view or
    change the information
    > the
    > initial state of the page is that the correct button is
    selected, but the
    > associated layer is not displaying onload.
    >
    > You have to reclick the radio button at each step
    because of the onClick
    > function. We are able to determine if the button is
    selected and send the
    > applicable instructions when the page is loaded (i.e.
    show or hide ...
    > or
    > ... change onClick to onLoad - but I can't get the
    behavior assigned to
    > the
    > radio button - and not sure if I am even using the
    correct behavior.
    >
    > If I am not explaining myself correctly - please advise
    and I will explain
    > more.
    >
    >
    >

  • How is a JQuery Vertical Accordian Different Than A Hide-Show Region

    Hello Everyone.
    I an using Apex 4.0.1. I recently learned how to create a JQuery vertical accordian. I'm using the sample accordian that Patrick Wolf recently created/posted. It uses a really nice "accordian template" that he put together. It's really quite useful when it comes to saving space and all on a page.
    Then I began wondering: How is this accordian different than Apex's own builtin Hide-Show Region template?
    And so, I created a sample page on my workspace in apex.oracle.com. I placed a JQuery vertical accordian that consists of 3 regions: 2 reports and a chart. I added a little bit of JQuery to Patrick's template that causes all 3 accordian slices to be closed as opposed to the default behavior of having one slice always open. I also added code that allows a user to re-size the entire accordian either vertically and/or horizontally.
    I then created 3 additional regions that mimic the first 3 regions above. These I placed in "column 2" on the page. For each region I assigned the "Hide-Show" template.
    As far as I can tell, both the accordian and the Hide-Show regions provide the same functionality.
    For the interested, here is a link to my page:
    http://apex.oracle.com/pls/apex/f?p=49919
    The app has open authentication assigned, and so, no login credentials are needed. Please click the "Accordian" tab.
    I realize that the accordian has more flexibilty in that one may add features like choosing to collapse/not collapse all slices and re-sizing, etc. I suppose one could do similarly for the Hide-Show regions using Javascript or JQuery but it would likely be an effort.
    Admittedly, such added features are cool and all. Still, it's been my experience that in the majority of business-like production environments, such "cool" features are pretty much useless. For example, I do not see how re-sizing the accordian or Hide-Show regions has much purpose. In fact, such "cool" features often get in the way of the main goal of the application.
    Of course, a JQuery accordian may also be created that expands/contracts slices "horizontally". I do not know of any way to do the same thing using Hide-Show regions. If someone does know how to do this, I (and likely others) would sure appreciate you sharing how.
    So, then, with respect to basic functionality (saving page real estate by encapsulating several regions), how is a JQuery vertical accordian any different than Apex's own builtin "Hide-Show" region?
    Thank you all for your thoughts/adice/code.
    Elie

    Hello Jari.
    Thank you for your help.
    Yes. Now I do understand what it is you are doing in your accordian page. And also I want to thsnk you for providing the sample code on your page showing how to go about preserving the current state of the accordian when you navigate from/to the page.
    You commented that this kind of state preservation is not available with the Hide/Show region. I'm thinking that you are correct, though I think I once saw something about doing this posted in this Forum. I'll search through and see if I can locate it.
    In any case, have you (or anyone else reading this thread) any other differences between a JQuery vertical accordian and Apex's own Hide/Show region? Other than being able to apply Javascript to an accordian to do things like preserve it's state (like you did), what else may one do with an accordian that is not doable (or at least not easily doable) with a Hide/Show region?
    Thank you for any further advice.
    Elie

  • Javascript help - Hide/Show a page item

    Environment:
    APEX 3.1.00.09 running on AIX 5.3
    Sample application on apex.oracle.com:
    Workspace: GALWAY
    UserID: gwicke
    Password: gwicke
    To see where my issues are:
    1- Start on page 3
    2- In the Agency drop down select 'J & B Marketing'
    3- In the Contract drop down select the only contract that appears
    4- Click on 'Edit Existing Contract'
    5- Note the page item 'LY Closings' has the value 261
    6- Click on the link (really a tab in my theme) at the top labeled 'Cost Detail'
    7- The 'Estimate Justification' is the page item to be displayed/hidden as noted below.
    8- The 'Homes Per Year' under the 'YEAR1' column is the user input page item
    9- The P2_BUILDER_CLOSINGS (value 261 noted above) is the page item to be used in the comparison
    I need to do a couple of things with a potentially hidden page item:
    1- Every time the page loads I need to check to see if the page item (P8_ESTIMATE_JUSTIFICATION) is not null and if it is indeed not null, make it displayed.
    2- When the user enters a value in another page item (P8_HOMES_PER_YEAR1), call a function to see if that value is more than 120% of another page item (P2_BUILDER_CLOSINGS) and if so make the above page item displayed (P8_ESTIMATE_JUSTIFICATION).
    I have the javascript function created (showHideEstimateJustification) and in the HTML Header of the page. The function is being called currently with an onChange check on the page item entered by the user as noted above (P8_HOMES_PER_YEAR1).
    Issues:
    1- I need to force a SUBMIT after the user enters the value for P8_HOMES_PER_YEAR1 so it is available in session state and hence to the javascript function (other ideas welcome!)
    2- I am currently using the x.style.display = 'inline' versus 'none' to hide/show the page item, where x is derived from var x = document.getElementById(P8_ESTIMATE_JUSTIFICATION) Is there a better way????
    Any help is greatly appreciated.
    -gary (a.k.a. Javascript newbie)

    Hi,
    Only your messages use the session state. The code would use the entered value, but you would need to change:
    var homes = parseInt(document.getElementById('P8_HOMES_PER_YEAR1'));to
    var homes = parseInt(document.getElementById('P8_HOMES_PER_YEAR1').value);so that "homes" becomes the numeric version of the value of the item
    Normally, for the label, you would just enter an ID="xxx" into the HTML Table Cell Attributes for the label which you can then use in your javascript. For some reason this doesn't seem to want to work in this page.
    What you could do is find all the labels and then check which is the right one before showing/hiding it. Something along the lines of:
    var xx = document.getElementsByTagName("LABEL");
    var zz;
    var label;
    for (zz = 0; zz < xx.length; zz++)
    if (xx[zz].htmlFor == 'P8_ESTIMATE_JUSTIFICTION")
      label = xx[zz];
    xx[zz].style.display = 'none';
    {code}
    Andy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Hide show button and textual area via Javascript or jQuery

    Hi folks am Apex newbie using 4.0.1 on Vista laptop running OracleXE (for dev purposes)
    A quick desc of what items are on the page of my Helpdesk appkication and what I want to achieve ..
    I have a Progress region defined on the page - with textual areas and some region buttons.
    Details are have 2 textual areas in my region - 1st textual area shows current progress (this is read only).
    Second textual region is where IT person will type latest progress on Helpdesk prob (ticket).
    There is a region button Save Progress Text which when pressed will append text from textual area 2 into textual area 1 and
    also appends text e.g date / time / userid etc of progress text added.
    This all works fine.
    Have added a new region button - call it Enter Progress Text - which I would like when pressed will make textual area 2 and the Save Progress Text buttons visible.
    I can hide and show the textual area 2 via $X_show / hide but cannot for life of me hide the Save Progress Text button.
    I also tried to make a subregion holding textual area 2 and the Svae Progress Text button but again via Javascript / jQuery could not hide the subregion.
    Can someone please tell me the syntax of how to hide via Javascript / jquery as can't find anything much at all in the Apex online documentation.
    Many, many thanks as always.
    P.S Don't want to use dynamic actions or hide / show region as want there to be buttons on screen to make things explicit for user hence my desire to use Javascript.
    Wiggywig

    Hi,
    If its a page item then you can use below script to hide it.
    <script type="text/javascript">
        $x_HideItemRow('Put your item name');
    </script>*Put this code in page footer..                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Error while trying to search in advanced table with hide/show region

    Hi
    I have search region and a results table with a hide.show in it.I did a search initially and got the results.I clicked on the hide/show region to see the details.
    I put another search criteria in the search region and tried to do a search.
    I am getting the following error
    The search cannot be executed because the table has pending changes that would be lost...
    Can anybody help me on this please....
    Message was edited by:
    user580745

    Any setter/getter method being used on hide/show action? How are you enabling the details? Is there a transient column in your VO?
    --Shiv                                                                                                                                                                                                                                                                                       

  • Trying to hide/show all series in legend with click on 'deselect' option.

    Hi Friends,
    I am trying to hide/show all series in legend with click on 'deselect' option. Please see the code below, let me what change i need to do:
    $(function () {
    $('#container').highcharts({
    chart: {
    type: 'line',
    marginRight: 130,
    marginBottom: 25
    title: {
    text: 'Monthly Average Temperature',
    x: -20 //center
    subtitle: {
    text: 'Source: WorldClimate.com',
    x: -20
    xAxis: {
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    yAxis: {
    title: {
    text: 'Temperature (°C)'
    plotLines: [{
    value: 0,
    width: 1,
    color: '#808080'
    tooltip: {
    valueSuffix: '°C'
    legend: {
    layout: 'vertical',
    align: 'right',
    verticalAlign: 'top',
    x: -10,
    y: 100,
    borderWidth: 0
                   plotOptions: {
    series: {
    events: {
    legendItemClick: function(event) {
    //var visibility = this.visible ? 'visible' : 'hidden';
    // (!confirm('The series is currently '+
    //visibility +'. Do you want to change that?')) {
    // alert ('other legend');
                                                                     if (this.name == 'Deselect')
    alert('hi');
    series.hide();
    //return false;
    series: [{
    name: 'Tokyo',
    data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
    name: 'New York',
    data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
    name: 'Berlin',
    data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
    name: 'London',
    data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
    name: 'Deselect',
    data: []
    Edited by: oracle_student_777 on Mar 27, 2013 10:05 PM
    Edited by: oracle_student_777 on Mar 28, 2013 4:08 AM
    Edited by: oracle_student_777 on Mar 28, 2013 8:59 PM
    Edited by: oracle_student_777 on Mar 28, 2013 11:15 PM

    More generally, Show All will only show when the Organizer isn't showing all your photos.  For example, if you click on a tag to show just the photos with that tag, the Show All button will show up.
    Alas, what I said above isn't completely true.   There are a number of situations where this rule doesn't hold:
    - When you've restricted the photos shown to a date range using Find > Set Date Range.
    - When you've restricted which media types to show using View > Media Types.
    - When you type text quickly into the search box and hit enter (on a large catalog).

  • How do I Reveal/Hide Hidden Layers for viewing with Acrobat Reader (iPad)?

    Hi,
    I've created a document in Quark Xpress with multiple layers which I then exported to a PDF. Using Acrobat Pro I created hotspots which revealed/hid these layers on rollover. It works perfectly on the desktop version of Acrobat Reader but not on Acrobat Reader for iPad (where the hidden layers are automatically switched on and touching the hotspots does not hide them). Does anybody know a good work around to this?

    There are many features which are possible in the desktop version of Adobe Reader which won't work in Reader for tablets. I think this is one of them. Probably no workaround possible until the feature is updated.

  • Can anyone tell me how to show/hide several layers simultaneously?

    Hello
    Can anyone show me how to  make more than one layer visible or invisible without having to click on each separate layer? - I have more than 100 layers in a drawing, and it is very tedious to keep having to click on each layer individually to hide it or show it. I have just started using Photoshop Elements 13, on an iMac
    Thanks for any advice.

    You can Option click on the eye beside the layer thumbnail icon to hide all but the selected layer(s).
    Option click again to show all the layers.
    Command click to toggle the selected layer visibilty on/off
    To hide multiple layers, select the layers, right click on one the eyes and click on Hide this layer
    Repeat to make the layers visible again.
    You can also click on one the eyes and then drag down or up to hide multiple layers and reverse to make the layers visible.

  • Can we Hide/Show the Mouse with an Action or a Script?

    Hello All,
    I am developing a simulation using click boxes in Captivate 4, on Windows XP. If the user doesn't click the right place, the slide continues, and shows the user what to do. If the user clicks the correct place, the simulation goes to the next slide directly. The problem is, successful or not, when the user goes to the next slide, the recorded mouse pointer displays on the slide. If I hide the mouse, then it remains hidden even if the user clicks outside the box too many times and the simulation continues, to show the user what to do. It's as if things on the screen just select or click themselves.
    I know mouse visibility is treated differently in the timeline than other objects. That's not a particularly big deal, so long as there is some way to control the mouse visibility for simulations (one of Captivate's big selling points). Is there a way to control the mouse visibility with an Action or with Script?
    The current settings for my click boxes are:
    I tried to assign an Action (multiple actions, really) to hide, show, enable, or disable the mouse but the mouse doesn't seem to be available to do so!
    Am I missing something?
    Thanks,
    ~jeff

    Hi there
    Nope, the mouse is an all or nothing object. It's either visible or not and it's your choice as to what you show. No way I'm aware of to programmatically display it. All I might suggest is that if you want to show the user the mouse moving, duplicate the slide so that if they fail to click the right area, the duplicated slide has the mouse moving to demonstrate.
    Oh, and consider submitting a Wish Form to ask for the capability in some future version of Captivate.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

Maybe you are looking for

  • Problems invoking a secure 8.1 web service from a 6.1 client

    I'm trying to invoke a secure 8.1 web service from a 6.1 client application and keep getting rejected with the following message: Security Violation: User: '<anonymous>' has insufficient permission to access EJB: In the 6.1 client, I've established a

  • Using region attributes to populate train skip property

    Hi Steven, It's been a while since I've looked at trains in 11g and now that I picked it up again I'm working on using the "skip" property of the train stop. Back in this thread Adding EL expression to train skip property you suggested modifying the

  • Space after SGEN ?

    hi, i have ERP6 EHP4 with 60 GB in database , but after running the SGEN T-Code it was increased to 90 GB and the log file also increased to 48 Gb from 3 GB . my question is , is this normal of this much of space . if yes then it's ok if not then wha

  • Regex Pattern help.

    Me and my friend pedrofire, that�s probably around forums somewhere, are newbies. We are trying to get a log file line and process correctly but we are found some dificculties to create the right expression pattern. My log have lines like: User 'INEX

  • Where to download Help files for PSE10? [was: Download question]

    I an using PSE10 and learning the program from a book that says that the help files are stored online at the Adobe web site.    Are the help files still accessible?    Downloadable?    Still available for version 10?