Results 1 to 2 of 2

Thread: toggle iframe url

  1. #1
    Join Date
    Aug 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default toggle iframe url

    Hi,

    I can't seem to find an answer to this issue anywhere so I hope I can get some help here...

    What i'm trying to do is to have an image or text toggle between 2 urls of an iframe.

    So on the first click it will change the iframe url and on the second it will get back to the first url.

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    
    <iframe name="iframe" src="http://www.google.com" style="width:400; height:400"></iframe>
    
    <p>&nbsp;</p>
    <p class="style1"><span style="color: #0000FF;font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold;"><a href="http://maps.google.com/" target="iframe">click</a></span></p>
    </body>
    </html>

    Thank you!

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Rather than toggle the iframe src it will probably be easier to have both iframes present on the page at load time but then toggle visibility between the two so only one appears to the user at any one time.

    Check out jQuery and hide() and show() http://jquery.com/
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

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
  •