iFrames in Dreamweaver CS3

Discussion in 'Web Design' started by philnolan3d, Aug 14, 2008.

to remove all ads.
  1. philnolan3d

    philnolan3d New Member

    Messages:
    26
    I finally figured out how to add and edit iFrames. But it's been a long time since I worked with them Is there a way to click a link on the main page and change the content in the iFrame?
     
  2. jnjc

    jnjc New Member

    Messages:
    493
    <body>
    <a href="http://www.nofuss.com.au"
    onclick="document.getElementById('test1').src=this.href;return false">test</a>

    <iframe id="test1" src="" height=50% width=50%></iframe>

    </body>



    HTH,
    JC
     
  3. philnolan3d

    philnolan3d New Member

    Messages:
    26
    Thank you that worked perfectly. It's also beyond anything I learned back in the 90's.
     
  4. joe

    joe New Member

    Messages:
    82
    Or you could have used target=framename. Not sure how "compliant" that is, but it saves a bit of typing time.
     
  5. philnolan3d

    philnolan3d New Member

    Messages:
    26
    That's actually what I was thinking it might be. But oh well, as long as I've got it typed in once it's essentially copy/paste from there.
     
  6. jnjc

    jnjc New Member

    Messages:
    493
    I don't think you are right. As far as I know "target" only works with framesets not iframes....
     
  7. joe

    joe New Member

    Messages:
    82
    No it works. I use it a lot. maybe you should try it for yourself.
     
  8. jnjc

    jnjc New Member

    Messages:
    493
    I did try it and it opens a new window when you click the link, can you post an example ?
     
  9. joe

    joe New Member

    Messages:
    82
    This should work.

    <a href="http://www.whatever.com" target="frame1">Click Here</a>
    <iframe name="frame1" src="somethingelse.com"></iframe>
     
  10. jnjc

    jnjc New Member

    Messages:
    493
    I stand corrected, it does work and it is a much better way of doing it then the method I suggested.

    The reason it wasn't working for me is because I used an 'id' on the iframe whereas I should have used 'name'.


    Thanks,
    JC
     
  11. joe

    joe New Member

    Messages:
    82
    yeah....I'm not that knowledgeable with javascript, just know how to manipulate it to work for me, so that's how I found the target attribute that does the trick for iframes.
     

Share This Page