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


Groups > comp.lang.javascript > #12219 > unrolled thread

hide image

Started bycerr <ron.eggler@gmail.com>
First post2012-02-27 16:26 -0800
Last post2012-02-29 16:08 +0000
Articles 11 — 8 participants

Back to article view | Back to comp.lang.javascript


Contents

  hide image cerr <ron.eggler@gmail.com> - 2012-02-27 16:26 -0800
    Re: hide image Andrew Poulos <ap_prog@hotmail.com> - 2012-02-28 13:04 +1100
      Re: hide image cerr <ron.eggler@gmail.com> - 2012-02-28 09:27 -0800
    Re: hide image Martin Pearman <warwound@gmail.com> - 2012-02-27 21:20 -0800
      Re: hide image cerr <ron.eggler@gmail.com> - 2012-02-28 09:27 -0800
    Re: hide image Christoph Hansen <ch@radamanthys.de> - 2012-02-28 19:08 +0100
      Re: hide image "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-29 09:13 +0000
        Re: hide image Scott Johnson <noonehome@chalupasworld.com> - 2012-02-29 06:12 -0800
          Re: hide image Scott Sauyet <scott.sauyet@gmail.com> - 2012-02-29 07:16 -0800
          Re: hide image Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-29 16:51 +0100
            Re: hide image "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-29 16:08 +0000

#12219 — hide image

Fromcerr <ron.eggler@gmail.com>
Date2012-02-27 16:26 -0800
Subjecthide image
Message-ID<311c476d-3627-445e-ad4d-67293693d5fa@s13g2000yqe.googlegroups.com>
Hi,

I would like to hide an image from a javascript function and for that,
I execute this code:
if (document.getElementById('editimg'+element)) {
	document.getElementById('editimg'+element).display = "none";
} else {
	alert("img not found!");
}
but it doesn't work, I also tried to set visibility="hidden"; but that
didn't work either. Any
hints or clues would be appreciated!
Thank you!
Ron

[toc] | [next] | [standalone]


#12223

FromAndrew Poulos <ap_prog@hotmail.com>
Date2012-02-28 13:04 +1100
Message-ID<YbqdnWYE9o2lq9HSnZ2dnUVZ_uGdnZ2d@westnet.com.au>
In reply to#12219
On 28/02/2012 11:26 AM, cerr wrote:

> I would like to hide an image from a javascript function and for that,
> I execute this code:
> if (document.getElementById('editimg'+element)) {
> 	document.getElementById('editimg'+element).display = "none";
> } else {
> 	alert("img not found!");
> }
> but it doesn't work, I also tried to set visibility="hidden"; but that
> didn't work either.

What value are you passing in your variable named "element"?

Andrew Poulos

[toc] | [prev] | [next] | [standalone]


#12237

Fromcerr <ron.eggler@gmail.com>
Date2012-02-28 09:27 -0800
Message-ID<48b66902-1df4-47a3-a13d-e3a2e831a16b@k29g2000yqc.googlegroups.com>
In reply to#12223
On Feb 27, 6:04 pm, Andrew Poulos <ap_p...@hotmail.com> wrote:
> On 28/02/2012 11:26 AM, cerr wrote:
>
> > I would like to hide an image from a javascript function and for that,
> > I execute this code:
> > if (document.getElementById('editimg'+element)) {
> >    document.getElementById('editimg'+element).display = "none";
> > } else {
> >    alert("img not found!");
> > }
> > but it doesn't work, I also tried to set visibility="hidden"; but that
> > didn't work either.
>
> What value are you passing in your variable named "element"?

That's just an integer type variable.

[toc] | [prev] | [next] | [standalone]


#12225

FromMartin Pearman <warwound@gmail.com>
Date2012-02-27 21:20 -0800
Message-ID<81c09aa4-5bf9-4a5a-bc37-4db6b297a5d2@gw9g2000vbb.googlegroups.com>
In reply to#12219
On Feb 28, 12:26 am, cerr <ron.egg...@gmail.com> wrote:
> Hi,
>
> I would like to hide an image from a javascript function and for that,
> I execute this code:
> if (document.getElementById('editimg'+element)) {
>         document.getElementById('editimg'+element).display = "none";} else {
>
>         alert("img not found!");}
>
> but it doesn't work, I also tried to set visibility="hidden"; but that
> didn't work either. Any
> hints or clues would be appreciated!
> Thank you!
> Ron

I think you need to set the style.display property not just display:

document.getElementById('editimg'+element).style.display = "none";

Martin.

[toc] | [prev] | [next] | [standalone]


#12238

Fromcerr <ron.eggler@gmail.com>
Date2012-02-28 09:27 -0800
Message-ID<517d1086-ee20-4b72-af30-a9b069363ad4@b1g2000yqb.googlegroups.com>
In reply to#12225
On Feb 27, 9:20 pm, Martin Pearman <warwo...@gmail.com> wrote:
> On Feb 28, 12:26 am, cerr <ron.egg...@gmail.com> wrote:
>
> > Hi,
>
> > I would like to hide an image from a javascript function and for that,
> > I execute this code:
> > if (document.getElementById('editimg'+element)) {
> >         document.getElementById('editimg'+element).display = "none";} else {
>
> >         alert("img not found!");}
>
> > but it doesn't work, I also tried to set visibility="hidden"; but that
> > didn't work either. Any
> > hints or clues would be appreciated!
> > Thank you!
> > Ron
>
> I think you need to set the style.display property not just display:
>
> document.getElementById('editimg'+element).style.display = "none";

Sweet, that's exactly it!
Thanks for that Martin! :)

[toc] | [prev] | [next] | [standalone]


#12265

FromChristoph Hansen <ch@radamanthys.de>
Date2012-02-28 19:08 +0100
Message-ID<jij57n$ri9$1@online.de>
In reply to#12219
cerr schrieb:

>  document.getElementById('editimg'+element).display = "none";

try this

document.getElementById('editimg'+element).style.display="none"

[toc] | [prev] | [next] | [standalone]


#12269

From"Evertjan." <exjxw.hannivoort@interxnl.net>
Date2012-02-29 09:13 +0000
Message-ID<XnsA008680E7DDC0eejj99@194.109.133.133>
In reply to#12265
Christoph Hansen wrote on 28 feb 2012 in comp.lang.javascript:

> cerr schrieb:
> 
>>  document.getElementById('editimg'+element).display = "none";
> 
> try this
> 
> document.getElementById('editimg'+element).style.display="none"

That is "not displaying".

Wouldn't call that "hiding" in html/css sense, try:

document.getElementById('x').style.visibility = "hidden";

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#12283

FromScott Johnson <noonehome@chalupasworld.com>
Date2012-02-29 06:12 -0800
Message-ID<jilbos$pgj$1@dont-email.me>
In reply to#12269
On 2/29/2012 1:13 AM, Evertjan. wrote:
> Christoph Hansen wrote on 28 feb 2012 in comp.lang.javascript:
>
>> cerr schrieb:
>>
>>>   document.getElementById('editimg'+element).display = "none";
>>
>> try this
>>
>> document.getElementById('editimg'+element).style.display="none"
>
> That is "not displaying".
>
> Wouldn't call that "hiding" in html/css sense, try:
>
> document.getElementById('x').style.visibility = "hidden";
>
  Just jumping in out of curiosity.

Is the difference between visibility and display the maintaining of the 
element flow?

Will Display take the element out of the flow where as visibility will 
keep it (sort of like a place holder so layout does not suffer)?

[toc] | [prev] | [next] | [standalone]


#12286

FromScott Sauyet <scott.sauyet@gmail.com>
Date2012-02-29 07:16 -0800
Message-ID<2422cddc-9725-43c6-9588-e1ea22b83ed7@l7g2000vbw.googlegroups.com>
In reply to#12283
Scott Johnson wrote:
> Is the difference between visibility and display the maintaining of the
> element flow?
>
> Will Display take the element out of the flow where as visibility will
> keep it (sort of like a place holder so layout does not suffer)?

Exactly right.

  -- Scott

[toc] | [prev] | [next] | [standalone]


#12292

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-02-29 16:51 +0100
Message-ID<1939153.aqSPkdTlGX@PointedEars.de>
In reply to#12283
Scott Johnson wrote:

> Is the difference between visibility and display the maintaining of the
> element flow?

Yes.

> Will Display take the element out of the flow where as visibility will
> keep it (sort of like a place holder so layout does not suffer)?

Loosely speaking, `display: none' renders the element as if it was not 
there; `visibility: hidden' does not paint the element, but reserves its box 
area.

<http://www.w3.org/TR/CSS2/visuren.html>

This question should have been asked in 
comp.infosystems.www.authoring.stylesheets, if necessary after reading the 
pertinent sections of the CSS 2.1 Specification.


PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

[toc] | [prev] | [next] | [standalone]


#12293

From"Evertjan." <exjxw.hannivoort@interxnl.net>
Date2012-02-29 16:08 +0000
Message-ID<XnsA008AE53659D6eejj99@194.109.133.133>
In reply to#12292
Thomas 'PointedEars' Lahn wrote on 29 feb 2012 in comp.lang.javascript:

> Scott Johnson wrote:
> 
>> Is the difference between visibility and display the maintaining of
>> the element flow?
> 
> Yes.
> 
>> Will Display take the element out of the flow where as visibility
>> will keep it (sort of like a place holder so layout does not suffer)?
> 
> Loosely speaking, `display: none' renders the element as if it was not
> there; `visibility: hidden' does not paint the element, but reserves
> its box area.
> 
> <http://www.w3.org/TR/CSS2/visuren.html>
> 
> This question should have been asked in 
> comp.infosystems.www.authoring.stylesheets, if necessary after reading
> the pertinent sections of the CSS 2.1 Specification.

Not exactly.

Read the word "maintaining" above.

CSS-only is static in this sense, 
while CSS-by-javascript is dynamic.

But than, as you don't believe in 'Javascript' ...

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web