SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict mserms's Avatar
    Join Date
    Jun 2001
    Location
    Scotland
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why should this not work in IE4?

    I'm crap at JS and can't work out why this doesn't work in IE4 (it's fine in IE5). I thought innerHTML was supported in IE4...

    Code:
    function changeLayer(obj1, obj2) {
    	//collects the value from a drop down menu
    	var selection = document.form.fall.selectedIndex;
    
    	if(selection == 0) {
    		//hide the layers
    		document.getElementById(obj1).innerHTML = "";
    		document.getElementById(obj2).innerHTML = "";
    	}
    	else if(selection == 1) {
    		//display stuff for -10%
    		document.getElementById(obj1).innerHTML = "<font color=#FFFFFF face='Arial, Helvetica, sans-serif' size=2>INVESCO Perpetual Monthly Income Plus (-9.2%)</font>";
    		document.getElementById(obj2).innerHTML = "<font size=2 color=#FFFFFF face='Arial, Helvetica, sans-serif'>11.1%</font>";	
    	}
    }
    Any clues?

  2. #2
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi there mserms...

    the problem with this script is not the use of .innerHTML to assign your new content...

    its the use of the .getElementById(obj1) method to reference the object you're wanting to alter..

    this method of object selection was not supported in IE4.

    to reference the objects in a way supported by IE4 you should use the 'document.all' collection:

    document.all[obj1].innerHTML = "whatever you want";


    i hope this helps
    [|::adickt::|]

  3. #3
    SitePoint Addict mserms's Avatar
    Join Date
    Jun 2001
    Location
    Scotland
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice one MM, I'll try it out.

  4. #4
    SitePoint Addict mserms's Avatar
    Join Date
    Jun 2001
    Location
    Scotland
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Works fine now, cheers mate.


  5. #5
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no worries, glad to help...
    [|::adickt::|]


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •