Is there a way to load html content in an iframe?

Discussion in 'C#' started by fluid, Jan 26, 2007.

  1. #1
    Im using ASP.NET and trying to load some html in an IFrame. I've got a string containing html source and i want to pass it to the iframe. Does anyone know how to do that? I tried iframe.innerhtml to no avail.

    Thanks.
     
    fluid, Jan 26, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    throw this in a function inside your external JS file.

    document.getElementById("YourFrameID").src = "http://google.com.au/search?q=" + searchTerms;

    This way you can change your Location of the iFrame on the fly.
     
    ccoonen, Jan 26, 2007 IP
  3. fluid

    fluid Active Member

    Messages:
    679
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    70
    #3
    The problem is that i dont want to point the iframe to a URL but rather load it with some html like:

    string _html = "<html><body>hello world</body></html";

    Any ideas?
     
    fluid, Jan 29, 2007 IP
  4. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #4
    ccoonen, Jan 29, 2007 IP
    fluid likes this.
  5. fluid

    fluid Active Member

    Messages:
    679
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    70
    #5
    Excellent info ccoonen. Thanks a lot :)
     
    fluid, Jan 30, 2007 IP
  6. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #6
    NP, Rep Appreciated, lol
     
    ccoonen, Jan 30, 2007 IP
  7. fluid

    fluid Active Member

    Messages:
    679
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    70
    #7
    You're most welcome :)
     
    fluid, Feb 1, 2007 IP