Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing source of an iframe.

    This works in IE:

    document.myIFrame.location.replace("somePage.html");

    But not in Netscape or Mozilla. Can someone suggest the best cross-platform way to change the src of an I-Frame?

    Also, a div I am using as a button has a css attribute set:

    cursor: pointer;

    This works correctly in Netscape/ Mozilla...a hand-cursor appears over my div. But in IE the default cursors show up (pointer and text-bar). However, if I use:

    cursor: hand;

    then exactly the opposite happens. Any advice?

    Thanks in advance!
    Last edited by Lee Brenner; 07-15-2002 at 05:19 PM.

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    the best way to get the iframe to work, cross browser, is this:

    window.frames['myIFrame'].location = 'somePage.htm';

    IE has a proprietary setting called 'hand', which means, if it's real important to you, you'll need to set up a small piece of JavaScript to see if the current browser is IE, and change the appropriate style.

    <script>
    if ( document.all ) {
    document.all['objectname'].style.cursor = 'hand';
    }
    </script>
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Check this out:

    http://webdesign.about.com/library/weekly/aa081501a.htm

    That's just how they work.

    Try this:

    <p onmouseover="if (navigator.appName=='Microsoft Internet Explorer'&&parseInt(navigator.appVersion)>=4) { this.style.cursor='hand' }else{ this.style.cursor='pointer' }">hello</p>

  • #4
    New Coder
    Join Date
    Jun 2002
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the tips...here's how I ended up dealing with the problems:

    Code:
    //works in all browsers I'm targeting
    frames['myIFrame'].location.href = "somePage.html";
    
    //works in all browsers I'm targeting 
    {
       cursor: pointer;
       cursor: hand;
    }

  • #5
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    I just set its src property:

    refToIframe.src = 'newpage.html';

    Works everywhere.

  • #6
    New Coder
    Join Date
    Jun 2002
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, but I can't get it to work by just setting the src property. I mean, I can when I first place the tag. But I can't programatically change it that way.

  • #7
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    refToIFRAME.setAttribute('src', 'newpage.html');

    also works.


  •  

    Posting Permissions

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