Iframe positioning

Discussion in 'JavaScript' started by chrisdavies, Dec 10, 2009.

  1. #1
    Dear All,

    After help from others here i have managed to create an iframe that loads content based on what platform (mac/pc) a user has.

    I did it using the following script:

    if(navigator.platform=='MacIntel') {
    document.write('<div class="iframe" style="top:300px; left:600px; z-index:20;" <iframe frameborder="0" scrolling="no" height="265" width="341" allowtransparency="true" name="myFrame" src="http://www.cerysrhysjones.co.uk/file/Mac.html"></iframe></div>');
    }

    Only problem i am now having is positioning it. The website i have designed is only 700px wide and is centered within the browser window, however, when i set positions for the iframe it stays were it is rather than moving with the rest of the website.

    Any help appreciated

    CHRIS
     
    chrisdavies, Dec 10, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Div closing is missing, may be that is reason for iframe not getting placed at right location.

    if(navigator.platform=='MacIntel') {
    document.write('<div class="iframe" style="top:300px; left:600px; z-index:20;"> <iframe frameborder="0" scrolling="no" height="265" width="341" allowtransparency="true" name="myFrame" src="http://www.cerysrhysjones.co.uk/file/Mac.html"></iframe></div>');
    }
     
    mastermunj, Dec 10, 2009 IP