Javascript: Img-Change-Problem with IE

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

    Javascript: Img-Change-Problem with IE

    Hello group!

    I've a problem with JavaScript and IMG-Objects.
    On my webpage I use a big image and several small images. If you click
    on a small image, it executes a JavaScript to change the source of the
    big image to the source of the small image.

    It's working fine, but on some browsers (I use IE 6.0.2800.1106) the
    image doesn't change properly.
    I click on the image and the big image turns white. Now I have to
    click on the image again and sometimes it works and changes the image
    (without reloading the site). I've found no logic, why it's working
    only sometimes.

    If you'd like to test, go to


    In the past I used IE 5.5 and all has worked fine. But after an update
    of my browser I've those errors.

    Does anybody know a workaround for the problem?

    Thanks for the support!

    Christian Kusenbach
  • ManoDestra

    #2
    Re: Javascript: Img-Change-Problem with IE

    Tell you what I wouldn't do. An anchor by it's nature is meant to be clicked
    and therefore has an href property which specifies what is to happen on
    clicking the anchor. Therefore unless there are two things you want to
    happen on clicking the anchor, don't specify an href property and an onClick
    property. Just do

    <a href="javascrip t:changePic('/images/something.gif') ;"><img
    src="something" border="0"></a>

    Don't know if this is what is causing you grief, but it's worth fixing this
    in the meantime.

    Peter.

    "Christian Kusenbach" <kusenbach@digi shop.de> wrote in message
    news:64ebfdc8.0 307230206.279c2 f28@posting.goo gle.com...[color=blue]
    > Hello group!
    >
    > I've a problem with JavaScript and IMG-Objects.
    > On my webpage I use a big image and several small images. If you click
    > on a small image, it executes a JavaScript to change the source of the
    > big image to the source of the small image.
    >
    > It's working fine, but on some browsers (I use IE 6.0.2800.1106) the
    > image doesn't change properly.
    > I click on the image and the big image turns white. Now I have to
    > click on the image again and sometimes it works and changes the image
    > (without reloading the site). I've found no logic, why it's working
    > only sometimes.
    >
    > If you'd like to test, go to
    > http://www.nwh.de/odb/index.cfm/fuse...Object/nID/534
    >
    > In the past I used IE 5.5 and all has worked fine. But after an update
    > of my browser I've those errors.
    >
    > Does anybody know a workaround for the problem?
    >
    > Thanks for the support!
    >
    > Christian Kusenbach[/color]


    Comment

    • Christian Kusenbach

      #3
      Re: Javascript: Img-Change-Problem with IE

      Hi Grant!

      Thanks a lot for your help!

      It seems to work fine now.

      Regards,

      Christian

      Grant Wagner <gwagner@agrico reunited.com> wrote in message news:<3F1ECFD0. 5956676B@agrico reunited.com>.. .[color=blue]
      > Your problem is the link definition you've used. The problem is described
      > to some extent at <url: http://jibbering.com/faq/#FAQ4_24 />
      >
      > Change your links from
      >
      > <a href="javascrip t:;" onclick="javasc ript:window.ope n(...)">
      >
      > to
      >
      > <a href="noJS.html " onclick="window .open(...);retu rn false;">
      >
      > noJS.html should contain some information about why the link isn't working
      > for them. If you don't like having your existing page wiped out to explain
      > to people with JavaScript not enabled you could use:
      >
      > <a href="noJS.html " target="noJSwin " onclick="window .open(...);retu rn
      > false;">
      >
      > if you never intended to support people without JavaScript enabled and
      > really don't care what happens to them when they click the link you can
      > use:
      >
      > <a href="#" onclick="window .open(...);retu rn false;">
      >
      > In each case, the important part is adding "return false" to the onclick
      > event.
      >
      > --
      > | Grant Wagner <gwagner@agrico reunited.com>
      >
      > * Client-side Javascript and Netscape 4 DOM Reference available at:
      > *
      > http://devedge.netscape.com/library/...ce/frames.html
      >
      > * Internet Explorer DOM Reference available at:
      > *
      > http://msdn.microsoft.com/workshop/a...ence_entry.asp
      >
      > * Netscape 6/7 DOM Reference available at:
      > * http://www.mozilla.org/docs/dom/domref/
      > * Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
      > * http://www.mozilla.org/docs/web-deve...upgrade_2.html[/color]

      Comment

      Working...