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 8 of 8
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    51
    Thanks
    2
    Thanked 0 Times in 0 Posts

    changing the "data" of an <object>

    Hello. I am sorry that I do not have the actual code with me, as I am working on it at school (which has blocked CF) and I lost my flash drive 2 days ago. I will do my best to replicate it.

    Here is what I am trying to do:
    I have an <object>:
    Code:
    <object data="jan.html" id="calendar"></object>
    and I am trying to change jan.html to feb.html with js in an onClick. I know how to do it with pictures (pic.src=""), but I have not succeeded with this. Is this possible? I have tried calendar.data="" and calendar.src="".

    Side note: the reason for this is because I'm trying to avoid using an iframe. But if that is the way I must do it, then I will.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You are trying to avoid the iframe because you are using a strict doctype?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    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
    You can always try something like:

    document.getElementById("calendar").contentDocument.location.href="newpage.html";

    (For Firefox/Safari at least), while IE would be .contentWindow instead.

  • #4
    New Coder
    Join Date
    Apr 2005
    Posts
    51
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_
    You are trying to avoid the iframe because you are using a strict doctype?
    I'm trying to avoid iframes because I hate frames.

    Quote Originally Posted by jkd
    You can always try something like:

    document.getElementById("calendar").contentDocument.location.href="newpage.html";

    (For Firefox/Safari at least), while IE would be .contentWindow instead.
    Thanks. I'll try that tomorrow. I forgot about getElementById.

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by Xiong Chiamiov
    I'm trying to avoid iframes because I hate frames.


    Thanks. I'll try that tomorrow. I forgot about getElementById.
    An object tag is just as bad and is considered active scripting in IE so if active scripting was disabled in IE, the object would not even show up for the user.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    New Coder
    Join Date
    Apr 2005
    Posts
    51
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_
    An object tag is just as bad and is considered active scripting in IE so if active scripting was disabled in IE, the object would not even show up for the user.
    Eh. So would using an iframe actually be better, as far as standards and ie and stuff go?

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Yeah I think it would be better.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    Regular Coder PremiumBlend's Avatar
    Join Date
    Apr 2006
    Location
    Marion, Iowa
    Posts
    201
    Thanks
    0
    Thanked 13 Times in 13 Posts
    You could just use the XMLHttpRequest object to load the HTML into a div tag.

    Here is a link that makes it pretty simple:
    http://www.w3schools.com/dom/dom_http.asp
    My Website: DumpsterDoggy


  •  

    Posting Permissions

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