dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Iframe using javascript?

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    18

    Iframe using javascript?

    Im new to Javascript so please be patient, lol

    I want to be able to hide a iframe and post results from a form into a new page if that makes sense
    <form action=/search.lx" method="get" target="test" name="Form">
    <iframe name="test" frameborder="0" marginwidth="0" marginheight="0" style="height: auto; text-align:center; width: 524px;" src ="includes/upsell_items.html">
    </iframe>

  2. #2
    Join Date
    Feb 2013
    Posts
    18
    This is what I have but not working right.

    What I want to do is hide the iframe until form is submitted, and possibly open up a new popup window
    <html>
    <body>
    <script type="text/javascript">

    document.getElementById("test").style.visibility= "hidden";</script>

    <table width="639"><tr><td valign="top" width="181" style="border-style: solid">
    <p align="center"><b><font face="Arial Narrow"><i>Search For:</i></font></b></p>
    <p><font face="Arial Narrow"><a href="http://ncl.outsideagents.com/travel/cruise/search_adv.rvlx?DestinationID=&cruise_duration=0-9999" target="iframetest">Cruise</a><br /><br />
    <a href="http://ncl.outsideagents.com/travel/air/" target="iframetest">Air</a><br /><br />
    <a href="http://ncl.outsideagents.com/travel/hotel/" target="iframetest">Hotel</a><br /><br />
    <a href="http://ncl.outsideagents.com/travel/car/" target="iframetest">Car</a><br /><br />
    <a href="http://ncl.outsideagents.com/travel/vacations/" target="iframetest">Packages</a><br /><br />
    </font></p>
    </td><td width="444">
    <iframe id="test" src="http://tmccaffery.outsideagents.com/travel/cruise/search_adv.rvlx?DestinationID=&cruise_duration=0-9999" width="575" height="600" name="test" frameborder="0"><font face="Arial Narrow">Sorry, your browser doesn't support iframes.</font></iframe>
    </td></tr></table>

  3. #3
    Join Date
    Jun 2011
    Posts
    6
    I can only give you an idea of how I would do it.

    You can use jQuery and bind a click event to the forms button. When the button is clicked a callback function will show the iframe, which was previously hidden by jQuery. If you want the iframe to show in a popup, there are many examples of using jQuery to show contents of a DIV element in a popup.

    If your starting out, using something like NetBeans php as your editor will help, it has Code Complete as a feature. You'll need to add the jQuery library to your project. I'm assuming your developing locally using a LAMP (Linux, Apache, MySQL, PHP) or WAMP (same as LAMP but running on windows not linux). I say it will help be because it will expose methods of the library, however the jQuery API documentation is really good.

    Good Luck !

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles