SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Possible to place a target=_parent inside an onclick event

    I have an onclick event which triggers an iframe to load within the targets page problem is i have a link which does this within a nested iframe, so when clicked it opens that iframe inside that iframe, is it possible to place with in an onclick event a code fragment that tells the link to open the page in the parent document?

    Code:
    href="/?p=research&pid=<?=$player->getId()?>" onclick="tb_show('', '/?p=researchmini&pid=<?=$player->getId()?>&KeepThis=true&TB_iframe=true&height=<?=$GLOBALS[popupheight]?>&width=<?=$GLOBALS[popupwidth]?>', true); return false;"

  2. #2
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know how experienced you are with Javascript, if you feel like I'm speaking down to you I apologise, I just want to make sure I don't miss anything I could tell you now.

    Somewhere in your scripts will be a definition for that function.
    If you search your scripts for the following words as they appear below
    Code:
    function tb_show
    You should find somthing that looks similar to this which will be defining what the function does.
    Code:
    function tb_show(somthing, somthing2, somthing3) {
      // stuff
    }
    That definition is needed in order to tell you what you need to do.

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks joe... my javascript is pretty horrible hehe so i do what i can to get by heh... but anyway.

    the onclick event calls this i guess...

    function tb_show(caption, url, imageGroup)

    and this function isinside a seperate js file

    basically im using thickbox, and ive modified the js file to do some little animations once it loads, and removed a few unwanted functions to cut down on the overall size however its still pretty much the same thickbox... but from what i can tell the only variables that are used when its passed into the function is the caption, and the url, in this case caption is just a blank string and the url is... well the url heh. looking into this a bit more i get the feeling its not going to be as simple as i think it is...

    Looking inside this function it appears to me it is appending html and css within the body of the document

  4. #4
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, that's not the simple task I thought it was going to be. I was thinking it was an issue with adding the word "parent" in a place or three.

    I'd try making a copy of that function, & having jQuery find the element a little differently.

    This isn't complete, but I think you get the picture comparing it to what you've got there.
    Code:
    if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
          $(window.parent.document).filter("body","html").css({height: "100&#37;", width: "100%"});
          $(window.parent.document).filter("html").css("overflow","hidden");
          if (window.parent.document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
            $(window.parent.document).filter("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
            $(window.parent.document).filter("#TB_overlay").click(tb_remove);
          }
        }else{//all others
          if(window.parent.document.getElementById("TB_overlay") === null){
            $(window.parent.document).filter("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
            $(window.parent.document).filter("#TB_overlay").click(tb_remove);
          }
        }

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    legend thanks mate ill have a bit of a play...


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
  •