Insert iframe using jquery? (newbie question)
I currently have a website with a number of menu items, many of which result in the main site being redisplayed but with an iframe being inserted somewhere within the middle of the page. The iframe is initially loaded as hidden but there is a JavaScript 'onload' routine which calculates the height of the iframe and then makes it visible in order to avoid the iframe showing scrollbars since the content of the iframe is variable.
Roughly, things look like this:
Menu button: reloads main page and passes one or more parameters, e.g. http://website.address.com&func=xyz¶m=abc
Then elements of the main page including the menu are displayed. Then, if specified by the relevant 'func' parameter the iframe is shown using code similar to the following:
- <div id="display5"></div>
- <iframe id="buffer5" name="buffer5" src="source URL with parameters" frameborder="1" height=0 width=730 onload="dw_displayExternal('buffer5', 'display5')" style="visibility: hidden;"></iframe>
This works fine but I was wondering whether there is any way of using jQuery such that I don't have to reload the page when the menu item is clicked. In other words, you'd click on the menu item and the relevant iframe would be inserted within the middle of the website, automatically sized.