How do I make an Image visible?

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

    How do I make an Image visible?

    Hi,

    I have the following code:
    <script>
    LeftCurtain=new Image(midPoint, ht);
    LeftCurtain.src ="images/black.gif";
    LeftCurtain.lef t="0px";
    LeftCurtain.top ="0px";
    LeftCurtain.vis ibility="visibl e";
    </script>


    Nothing appears. Not in Firefox, Opera or IE7.

    Can anyone let me know what's wrong?

  • Richard Cornford

    #2
    Re: How do I make an Image visible?

    David Mark wrote:
    On Sep 30, 3:31 pm, Cov wrote:
    <snip>
    > LeftCurtain=new Image(midPoint, ht);
    >
    Where are these two parameters defined?
    >
    > LeftCurtain.src ="images/black.gif";
    > LeftCurtain.lef t="0px";
    >
    LeftCurtain.sty le.left = "0";
    Zero is zero, regardless of the unit. Also, you need to set the
    position property to absolute, fixed or relative (default is static.)
    >
    > LeftCurtain.top ="0px";
    >
    Same problem here.
    <snip>

    Not that it is a problem as such. Not providing a non-zero dimension
    with a unit can be a problem but omitting the unit from a zero dimension
    is not required.

    A more significant issue may follow from the assumption that the object
    returned from - new Image( ... ) - would have a - style - object. There
    is no specification that could provide guidance, but historically that
    has not necessarily been the case.

    Richard.

    Comment

    • Cov

      #3
      Re: How do I make an Image visible?

      On Sep 30, 11:10 pm, David Mark <dmark.cins...@ gmail.comwrote:
      Again, sounds like a pretty poor (or at least outdated) guide.


      Comment

      • David Mark

        #4
        Re: How do I make an Image visible?

        On Sep 30, 5:12 pm, "Richard Cornford" <Rich...@litote s.demon.co.uk>
        wrote:
        David Mark wrote:
        On Sep 30, 3:31 pm, Cov wrote:
        <snip>
        LeftCurtain=new Image(midPoint, ht);
        >
        Where are these two parameters defined?
        >
        LeftCurtain.src ="images/black.gif";
        LeftCurtain.lef t="0px";
        >
        LeftCurtain.sty le.left = "0";
        Zero is zero, regardless of the unit. Also, you need to set the
        position property to absolute, fixed or relative (default is static.)
        >
        LeftCurtain.top ="0px";
        >
        Same problem here.
        >
        <snip>
        >
        Not that it is a problem as such. Not providing a non-zero dimension
        with a unit can be a problem but omitting
        You lost me there unless you are talking about older browsers where
        typeof(el.style .top) == 'number'.

        the unit from a zero dimension
        is not required.
        Not required, it just seems silly to me to provide one. One caveat is
        that Firefox returns "0pt" (of all things) for the computed style when
        the unit is left off the assignment. It doesn't really matter as you
        obviously ignore the unit in any case where the value is zero.
        >
        A more significant issue may follow from the assumption that the object
        returned from - new Image( ... ) - would have a - style - object. There
        Right. That's why I told the OP to use createElement.

        Comment

        • Randy Webb

          #5
          Re: How do I make an Image visible?

          Thomas 'PointedEars' Lahn said the following on 9/30/2007 6:16 PM:
          Cov wrote:
          >On Sep 30, 11:10 pm, David Mark <dmark.cins...@ gmail.comwrote:
          >>Again, sounds like a pretty poor (or at least outdated) guide.
          >http://www.amazon.com/JavaScript-Def...1186893&sr=8-1
          >
          Thanks for further confirmation that also this book can definitely and
          safely be recommended against. How many more bad examples from it are
          required until the FAQ maintainer eventually removes the recommendation from
          the FAQ?
          It won't be removed any time in the foreseeable future so you can -
          safely - stop asking for it to be removed.

          And, what does the third edition have to do with the edition listed in
          the FAQ?

          --
          Randy
          Chance Favors The Prepared Mind
          comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
          Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

          Comment

          • Cov

            #6
            Re: How do I make an Image visible?

            On Oct 1, 5:07 am, Randy Webb <HikksNotAtH... @aol.comwrote:
            Thomas 'PointedEars' Lahn said the following on 9/30/2007 6:16 PM:
            >
            Cov wrote:
            On Sep 30, 11:10 pm, David Mark <dmark.cins...@ gmail.comwrote:
            >Again, sounds like a pretty poor (or at least outdated) guide.
            >http://www.amazon.com/JavaScript-Def...-Flanagan/dp/0...
            >
            Thanks for further confirmation that also this book can definitely and
            safely be recommended against. How many more bad examples from it are
            required until the FAQ maintainer eventually removes the recommendation from
            the FAQ?
            >
            It won't be removed any time in the foreseeable future so you can -
            safely - stop asking for it to be removed.
            >
            And, what does the third edition have to do with the edition listed in
            the FAQ?
            >
            --
            Randy
            Chance Favors The Prepared Mind
            comp.lang.javas cript FAQ -http://jibbering.com/faq/index.html
            Javascript Best Practices -http://www.JavascriptT oolbox.com/bestpractices/
            Funny; I ask for help on why a piece of code I write won't work and
            get castigated for attempting something that, in the opinion of one
            poster, is beyond me.

            Then the whole thing degenerates into mud slinging and petty point
            scoring.

            Does ANYBODY come here for assistance or is this newsgroup solely for
            the self-indulgence of the senior members?

            Comment

            • Randy Webb

              #7
              Re: How do I make an Image visible?

              Thomas 'PointedEars' Lahn said the following on 10/1/2007 4:03 AM:
              Randy Webb wrote:
              >Thomas 'PointedEars' Lahn said the following on 9/30/2007 6:16 PM:
              >>Cov wrote:
              >>>On Sep 30, 11:10 pm, David Mark <dmark.cins...@ gmail.comwrote:
              >>>>Again, sounds like a pretty poor (or at least outdated) guide.
              >>>http://www.amazon.com/JavaScript-Def...1186893&sr=8-1
              >>Thanks for further confirmation that also this book can definitely and
              >>safely be recommended against. How many more bad examples from it are
              >>required until the FAQ maintainer eventually removes the recommendation from
              >>the FAQ?
              >It won't be removed any time in the foreseeable future so you can -
              >safely - stop asking for it to be removed.
              >
              You as a *responsible* FAQ editor leaving a statement in the FAQ that this
              book is "currently endorsed by c.l.j. regulars of comp.lang.javas cript"
              should first make sure that it *is* actually currently endorsed by the
              regulars of comp.lang.javas cript.
              It is nice to see that you have assumed I haven't done something that I
              did do. Can you post articles in the last 8 months where people have
              commented on the book? I have read them all. Perhaps you should also.
              Or you have proven to be inept enough to be the editor of the newsgroup's
              FAQ and should be replaced by a more reasonable person ASAP.
              Coming from you, that is hilarious.
              BTW: It should be "c.l.js" or "cljs" to distinguish it from comp.lang.java. *
              The newsgroup is comp.lang.javas cript and its abbreviation has always
              been clj/c.l.j and I will continue to refer to it as clj/c.l.j as my
              mood sees fit.

              --
              Randy
              Chance Favors The Prepared Mind
              comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
              Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

              Comment

              • Gregor Kofler

                #8
                Re: How do I make an Image visible?

                Cov meinte:
                I read that and did ask for specifics and was advised to Google for
                "JavaScript createElement appendChild." which produced no meaningful
                results.
                What do you understand by "meaningful results"? I suppose most of the
                stuff I know about JS, HTML, PHP, MySQL etcpp. stems from online
                resources - mainly queried with a search engine.

                "javascript appendchild" gives me the German



                as first hit, which explains the above issue pretty well.

                The first English hit is



                which also sports a simple example how appendChild works.

                Gregor



                --
                http://www.gregorkofler.at ::: Landschafts- und Reisefotografie
                http://www.licht-blick.at ::: Forum für Multivisionsvor träge
                http://www.image2d.com ::: Bildagentur für den alpinen Raum

                Comment

                • Dr J R Stockton

                  #9
                  Re: How do I make an Image visible?

                  In comp.lang.javas cript message <4702A484.10608 02@PointedEars. de>, Tue,
                  2 Oct 2007 22:05:24, Thomas 'PointedEars' Lahn <PointedEars@we b.de>
                  posted:
                  >
                  >You would not leave statements that are made in the name of *all* the
                  >regulars of the newsgroup in the FAQ if there is any doubt that not all
                  >regulars of the group support that statement. You would do a strawpoll
                  >at least once to back up such statements in the FAQ.
                  In English, in which language you are not as adept as you seem to think,
                  "the regulars" does not necessarily imply "all of the regulars"; indeed,
                  we should use "all of the regulars" if we want to mean that. It only
                  means a substantial majority of the regulars; maybe over 66%, better
                  over 75% or 80%; 90% seems too high a mark.

                  --
                  (c) John Stockton, Surrey, UK. ???@merlyn.demo n.co.uk Turnpike v6.05 MIME.
                  Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
                  Check boilerplate spelling -- error is a public sign of incompetence.
                  Never fully trust an article from a poster who gives no full real name.

                  Comment

                  • Laurent vilday

                    #10
                    Re: How do I make an Image visible?

                    Thomas 'PointedEars' Lahn a écrit :
                    BTW: It should be "c.l.js" or "cljs" to distinguish it from comp.lang.java. *
                    LOL

                    <news://comp.lang.java. security>
                    <news://comp.lang.java. setup>
                    <news://comp.lang.java. softwaretools>

                    --
                    laurent

                    Comment

                    • rf

                      #11
                      Re: How do I make an Image visible?

                      Whover wrote:

                      Would you take this bloody shit offline please!



                      Comment

                      • Dr J R Stockton

                        #12
                        Re: How do I make an Image visible?

                        In comp.lang.javas cript message <zJidnZFoo-BIX5PaRVn_vwA@g iganews.com>,
                        Thu, 11 Oct 2007 20:42:01, Randy Webb <HikksNotAtHome @aol.composted:
                        >
                        >Again, you refuse to accept what I agreed to do. What you keep whining
                        >about is that I won't do more than I agreed to do. And in regards to
                        >that, what I said I would do is *very* relevant.
                        The question is also one of whether we understood and agreed to that;
                        and of whether what you are now doing is satisfactory.

                        In comparison with what all other active FAQ maintainers do, your
                        approach is ludicrous.

                        --
                        (c) John Stockton, Surrey, UK. ???@merlyn.demo n.co.uk Turnpike v6.05 MIME.
                        Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
                        Check boilerplate spelling -- error is a public sign of incompetence.
                        Never fully trust an article from a poster who gives no full real name.

                        Comment

                        • Randy Webb

                          #13
                          Re: How do I make an Image visible?

                          Dr J R Stockton said the following on 10/12/2007 3:42 PM:
                          In comp.lang.javas cript message <zJidnZFoo-BIX5PaRVn_vwA@g iganews.com>,
                          Thu, 11 Oct 2007 20:42:01, Randy Webb <HikksNotAtHome @aol.composted:
                          >Again, you refuse to accept what I agreed to do. What you keep whining
                          >about is that I won't do more than I agreed to do. And in regards to
                          >that, what I said I would do is *very* relevant.
                          >
                          The question is also one of whether we understood and agreed to that;
                          and of whether what you are now doing is satisfactory.
                          It was stated enough in the thread I pointed you to that if you did not
                          understand what I offered to do then it was because you took no effort
                          to understand it.
                          In comparison with what all other active FAQ maintainers do, your
                          approach is ludicrous.
                          What is "ludicrous" is your inability to accept that I offered to do
                          something and I have done exactly what I said I would do.

                          Stop whining and let it go. Sheesh.

                          --
                          Randy
                          Chance Favors The Prepared Mind
                          comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
                          Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

                          Comment

                          • Dr J R Stockton

                            #14
                            Re: How do I make an Image visible?

                            In comp.lang.javas cript message <jqSdnZjjjaQp1Y 3aRVn_vwA@gigan ews.com>,
                            Sat, 13 Oct 2007 00:26:04, Randy Webb <HikksNotAtHome @aol.composted:
                            >Dr J R Stockton said the following on 10/12/2007 3:42 PM:
                            >In comp.lang.javas cript message <zJidnZFoo-BIX5PaRVn_vwA@g iganews.com>,
                            >Thu, 11 Oct 2007 20:42:01, Randy Webb <HikksNotAtHome @aol.composted:
                            >>Again, you refuse to accept what I agreed to do. What you keep whining
                            >>about is that I won't do more than I agreed to do. And in regards to
                            >>that, what I said I would do is *very* relevant.
                            > The question is also one of whether we understood and agreed to
                            >>that;
                            >and of whether what you are now doing is satisfactory.
                            >
                            >It was stated enough in the thread I pointed you to that if you did not
                            >understand what I offered to do then it was because you took no effort
                            >to understand it.
                            That is irrelevant.
                            >In comparison with what all other active FAQ maintainers do, your
                            >approach is ludicrous.
                            >
                            >What is "ludicrous" is your inability to accept that I offered to do
                            >something and I have done exactly what I said I would do.
                            Which is not what needs to be done.

                            There is a mistake in the parenthesised text of FAQ 4.16 (ignoring the
                            missing comma).

                            --
                            (c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Delphi 3? Turnpike 6.05
                            <URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
                            <URL:http://www.bancoems.co m/CompLangPascalD elphiMisc-MiniFAQ.htmclpd mFAQ;
                            <URL:http://www.borland.com/newsgroups/guide.htmlnews: borland.* Guidelines

                            Comment

                            • Randy Webb

                              #15
                              Re: How do I make an Image visible?

                              Dr J R Stockton said the following on 10/13/2007 6:21 PM:
                              In comp.lang.javas cript message <jqSdnZjjjaQp1Y 3aRVn_vwA@gigan ews.com>,
                              Sat, 13 Oct 2007 00:26:04, Randy Webb <HikksNotAtHome @aol.composted:
                              >Dr J R Stockton said the following on 10/12/2007 3:42 PM:
                              >>In comp.lang.javas cript message <zJidnZFoo-BIX5PaRVn_vwA@g iganews.com>,
                              >>Thu, 11 Oct 2007 20:42:01, Randy Webb <HikksNotAtHome @aol.composted:
                              >>>Again, you refuse to accept what I agreed to do. What you keep whining
                              >>>about is that I won't do more than I agreed to do. And in regards to
                              >>>that, what I said I would do is *very* relevant.
                              >> The question is also one of whether we understood and agreed to
                              >>that;
                              >>and of whether what you are now doing is satisfactory.
                              >It was stated enough in the thread I pointed you to that if you did not
                              >understand what I offered to do then it was because you took no effort
                              >to understand it.
                              >
                              That is irrelevant.
                              No, it is the problem. You want to continue to whine about something
                              after the fact that you had ample opportunity to comment on before it
                              happened. You had no written objections at the time and now, after
                              almost a year, you want to whine and complain about it.
                              >>In comparison with what all other active FAQ maintainers do, your
                              >>approach is ludicrous.
                              >What is "ludicrous" is your inability to accept that I offered to do
                              >something and I have done exactly what I said I would do.
                              >
                              Which is not what needs to be done.
                              Either way, you have two choices:

                              1) Accept it.
                              2) Continue to whine like an 8 year old.
                              There is a mistake in the parenthesised text of FAQ 4.16 (ignoring the
                              missing comma).
                              Then read the FAQ, find out how to make a request to have it corrected,
                              and it will get corrected. Pay real close attention Section 5.2 and the
                              last line of the first paragraph of the preceding sub-section.
                              --
                              Randy
                              Chance Favors The Prepared Mind
                              comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
                              Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

                              Comment

                              Working...