javascript - How to dynamically embed html into a frame tag -


i trying fetch data using jquery ajax library , want add returned html data frame object (without setting source attribute). general idea want showcase html content seperate document in frame. tried putting data div had effect of affecting main document. thanks!

the frame is:

    <frame id="test">  </frame>  $.ajax({ url : url }) .done(function(html) { document.getelementbyid('test').innerhtml = html }); 

the problem seems getelementbyid function return null. problem resolved if change frame div.

problem solved! article surprisingly hard find. essentially, code used solve :

doc = document.getelementbyid('test').contentdocument; doc.open(); doc.writeln('<p> hello! </p>') doc.close(); 

the article : http://softwareas.com/injecting-html-into-an-iframe


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -