Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31146

Re: problem with disabling div

Path csiph.com!aioe.org!.POSTED!not-for-mail
From Jivanmukta <jivanmukta@poczta.onet.pl>
Newsgroups comp.lang.javascript
Subject Re: problem with disabling div
Date Wed, 24 Aug 2016 09:23:35 +0200
Organization Aioe.org NNTP Server
Lines 81
Message-ID <npji1n$c49$1@gioia.aioe.org> (permalink)
References <ea5c8a11-d715-4649-a0e8-f69f9775d0b2@googlegroups.com> <np92e2$ska$1@dont-email.me>
NNTP-Posting-Host h3OcO/f1tpR+ZfDT607aAA.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Complaints-To abuse@aioe.org
User-Agent KNode/4.14.2
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.javascript:31146

Show key headers only | View raw


I added to my view "show/hide attachments" button. I want to have 
attachments invisible by default. When user presses "show attachments" the 
attachments (images and movies) should be shown. When user presses "hide 
attachments" the attachments should be hidden. The attachments should never 
be printed.

Here is main part of my view:

<div align="center">
<input id="print_announcement1" name="print_announcement" type="button" 
class="normal_button" value="Print announcement" onclick="window.print();">
</div>
<br>
<style type="text/css" media="print">
input#print_announcement1, input#summary1, input#print_announcement2, 
input#summary2, input#show_hide_attachments, div#attachments { display: 
none; }
</style>
<script type="text/javascript">
function showHideAttachments(btn) {
    var a = document.getElementById('attachments');
    var movies = document.getElementsByTagName('embed');
    var i;
    if (a.style.visibility == 'hidden') {
        a.style.visibility = 'visible';
        for (i = 0; i < movies.length; i++) {
            movies[i].hidden = false;
        }
        btn.value = 'Hide attachments';
    } else if (a.style.visibility == 'visible') {
        a.style.visibility = 'hidden';
        for (i = 0; i < movies.length; i++) {
            movies[i].hidden = true;
        }
        btn.value = 'Show attachments';
    }
}
</script>
<table id="printout" border="0">
<caption>
<h6>Announcement</h6>
<hr>
</caption>
<tfoot>
<tr><td colspan="2"><hr></td></tr>
</tfoot>
<tbody>
... <!-- announcement data -->
<?php
if ($images + $movies > 0) {
    echo "<tr><td>Attachments:</td><td>";
    echo '<b>', $images, ' images, ', $movies, ' movies</b> ';
    echo '<input id="show_hide_attachments" type="button" value="Show 
attachments" onclick="showHideAttachments(this);">';
    echo '</td></tr></tbody></table>';
    echo '<div id="attachments" align="center" style="visibility: hidden">';
    $dir = getPicturesDir($fullAnnouncementNo);
    $picturesDir = substr($dir, strlen($publicHtmlDir) + 1);
    $pictures = getPicturesOf($fullAnnouncementNo);
    foreach ($pictures as $p) {
        if (isMovie($p)) {
            echo '<embed hidden="true" autostart="false" height="0" 
width="0" src="' . base_url($picturesDir . '/' . $p) . '"><br>';
        } elseif (isImage($p)) {
            echo '<img src="' . base_url($picturesDir . '/' . $p) .'"><br>';
        }
    }
    echo '<input id="print_announcement2" name="print_announcement" 
type="button" class="normal_button" value="Print announcement" 
onclick="window.print();">';
    echo '</div>';
}
?>

I use <embed hidden="true" autostart="false" ...> becase I don't want the 
movies to be displayed at document load.
The problem is that the movies are not displayed at all when user presses 
"show attachments". I don't know why and I don't know how to program it 
correctly.
Please help.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

problem with disabling div jivanmukta@poczta.onet.pl - 2016-08-20 00:32 -0700
  Re: problem with disabling div Osmo Saarikumpu <osmo@weppipakki.com> - 2016-08-20 10:55 +0300
    Re: problem with disabling div jivanmukta@poczta.onet.pl - 2016-08-20 02:08 -0700
    Re: problem with disabling div Jivanmukta <jivanmukta@poczta.onet.pl> - 2016-08-24 09:23 +0200
      Re: problem with disabling div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-24 10:30 +0200
        Re: problem with disabling div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-24 10:48 +0200
          Re: problem with disabling div Jivanmukta <jivanmukta@poczta.onet.pl> - 2016-08-24 12:32 +0200
            Re: problem with disabling div Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-24 19:27 +0200
        Re: problem with disabling div Jivanmukta <jivanmukta@poczta.onet.pl> - 2016-08-24 11:17 +0200
          Re: problem with disabling div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-24 11:50 +0200
          Re: problem with disabling div Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-24 19:24 +0200
            Re: problem with disabling div John Harris <niam@jghnorth.org.uk.invalid> - 2016-08-24 20:08 +0100
              Re: problem with disabling div Andrew Poulos <ap_prog@hotmail.com> - 2016-08-25 06:47 +1000
                Re: problem with disabling div John Harris <niam@jghnorth.org.uk.invalid> - 2016-08-25 09:47 +0100
                Re: problem with disabling div Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-25 18:37 +0200
                Re: problem with disabling div John Harris <niam@jghnorth.org.uk.invalid> - 2016-08-26 10:46 +0100
                Re: problem with disabling div Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-08-25 22:46 +0100
                Re: problem with disabling div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-26 12:41 +0200
                Re: problem with disabling div Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-08-27 21:02 +0100
                Re: problem with disabling div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-28 12:07 +0200
                Re: problem with disabling div Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-08-29 21:39 +0100
                Re: problem with disabling div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-30 10:45 +0200
                Re: problem with disabling div $Bill <news@todbe.com> - 2016-08-28 03:25 -0700

csiph-web