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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HTML change iframe source need a button maybe?

    So I have an HTML iframe but i want to have a button that will change the source of the iframe. is this possible?

    heres what i got so far

    Code:
    <body>
    
    <iframe id="adframe" style="background-color:#ffffff" align="left" height="360" width="600" marginwidth="0" marginheight="0" frameborder="0" scrolling="yes" 
    src="sales.htm">
    </iframe>

    I cut out most of the page that was irrelevant (i think) to this problem

    Any help would be great

  • #2
    Regular Coder Kristofa's Avatar
    Join Date
    Jun 2009
    Location
    Leicester
    Posts
    143
    Thanks
    7
    Thanked 20 Times in 20 Posts
    With Javascript - yes.

    Put this in your <head> tags.

    Code:
    <script type="text/javascript">
    function newlink()
    {
    document.getElementById('adframe').src = "YOUR URL HERE";
    }
    </script>
    And this button somewhere on the page.
    Code:
    <button onclick="newlink()">Change Url</button>
    Think that will work, my Javascript knowledge is pretty limited.
    Learning along the way...

  • #3
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'll try that thanks for your help. I'll give you a thanks as soon as i try it out kool.


  •  

    Posting Permissions

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