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


Groups > comp.lang.javascript > #18163

IE8 attachEvent problem

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "Mel Smith" <med_cutout_syntel@aol.com>
Newsgroups comp.lang.javascript
Subject IE8 attachEvent problem
Date Sun, 20 Jan 2013 10:42:14 -0700
Lines 80
Message-ID <am2ojqFk54hU1@mid.individual.net> (permalink)
X-Trace individual.net mIKKQLwALXX4UFXZptcc3QlPwovAqKBi2Xn1/u5y1AxuLFacH+Q9ZTiQhcWE1ziDAZ
Cancel-Lock sha1:AlERH/KAXonjWgmy5jmH1PiDy7o=
X-Priority 3
X-MSMail-Priority Normal
X-Newsreader Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.6157
X-RFC2646 Format=Flowed; Original
Xref csiph.com comp.lang.javascript:18163

Show key headers only | View raw


Hi:

Environment: As a client using an IE8 browser on a Win XP Pro (sp2) machine:

    Within  the javascript code in my page there is a 'function remember()'. 
It is shown as --- the problem function --- below. The function 'remembers' 
where in a long table my user was viewing, so that when he 'returns' to the 
page, I position his viewport to the 'remembered' set of lines. It has 
worked fine for a long time but under IE7. Recently, I have started using 
IE8 as a testbed (in addition to Chrome and FF), and set IE8 to show me JS 
errors when viewing pages.

    When this remember function is called , IE8 shows a 'Type Mismatch' 
error at character 4 of
the offending line (indicated by asterisks ("*****") below.

    When viewed with Chrome and FF, there is no problem because these 
browsers use addEventListener as the event handler (instead of attachEvent).

    I'm not a newbie, just a stupie,  and would like to continue using this 
'remember' function without the error.

    Hope that someone can help me fix  this error on IE8

Thank you.

--
Mel Smith
Mesa, Arizona

------- the problem function ----------

function remember(e) {
var targ,tid;
if (!e)
  {
  var e=window.event;
  }
if (e.target)
  {
  targ=e.target;
  }
else if (e.srcElement)
  {
  targ=e.srcElement;
  }
if (targ.nodeType==3) // defeat Safari bug
  {
  targ = targ.parentNode;
  }
tid=targ.id;

if (window.addEventListener) {
   window.addEventListener("load",document.getElementById(tid).scrollIntoView(),false) 
;
}
else if (window.attachEvent) {

   // ********** next line shows a 'Type Mismatch' error at char(4) 
********
   window.attachEvent("onload",document.getElementById(tid).scrollIntoView()) 
;
}
else {
   alert("c. No adding or attaching") ;
   window.onload = "document.getElementById(tid).scrollIntoView();"
}

return ;
}






-- 
Mel Smith

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


Thread

IE8 attachEvent problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-20 10:42 -0700
  Re: IE8 attachEvent problem Martin Honnen <mahotrash@yahoo.de> - 2013-01-20 18:55 +0100
    Re: IE8 attachEvent problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-20 10:59 -0700
      Re: IE8 attachEvent problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-20 11:24 -0700
        Re: IE8 attachEvent problem Martin Honnen <mahotrash@yahoo.de> - 2013-01-21 12:06 +0100
          Re: IE8 attachEvent problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-21 09:52 -0700
  Re: IE8 attachEvent problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-20 20:11 +0100
    Re: IE8 attachEvent problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-20 13:21 -0700
      Re: IE8 attachEvent problem Bjoern Hoehrmann <bjoern@hoehrmann.de> - 2013-01-20 21:44 +0100
        Re: IE8 attachEvent problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-21 00:07 +0100
        Re: IE8 attachEvent problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-20 16:19 -0700
          Re: IE8 attachEvent problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-20 17:18 -0700
    Re: IE8 attachEvent problem Martin Honnen <mahotrash@yahoo.de> - 2013-01-21 18:28 +0100
      Re: IE8 attachEvent problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-21 19:07 +0100
        Re: IE8 attachEvent problem Martin Honnen <mahotrash@yahoo.de> - 2013-01-21 19:33 +0100
        Re: IE8 attachEvent problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-21 13:05 -0700
          Re: IE8 attachEvent problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-22 09:00 +0100
  Re: IE8 attachEvent problem Arty Effem <ignoring@mail.com> - 2013-01-23 13:49 -0800

csiph-web