Results 1 to 2 of 2

Thread: display hidden iFrame onclick

  1. #1
    Join Date
    May 2008
    Posts
    1

    display hidden iFrame onclick

    Hello,
    I have a problem with Javascript. I am trying to show a hidden iFrame when user submits form. I am new in php and javascript .....please help
    here is the code
    javascript in head section of html
    <script type="text/javascript">
    <!--
    function hideMe(){
    // Hide or show iframe

    if(document.getElementById("myframe").style.visibility=="visible"){
    document.getElementById("myframe").style.visibility="hidden"
    }
    else{
    document.getElementById("myframe").style.visibility="visible"
    }
    //-->
    </script>

    body

    <input name="shrani" type="submit" id="shrani" value="Shrani" onclick="hideMe()"/>
    <iframe id="myframe" width="100%" src="vnosPozicija.php" style="visibility:hidden"></iframe>

  2. #2
    Join Date
    Jun 2008
    Posts
    3
    try this instead:

    javascript in head section of html
    <script type="text/javascript" language="Javascript">
    <!--
    function hideMe(){
    // Hide or show iframe

    if(document.getElementById("myframe").style.visibility = "visible"){
    document.getElementById("myframe").style.visibility = "hidden";
    }
    else{
    document.getElementById("myframe").style.visibility =" visible";
    }
    }
    //-->
    </script>

    body

    <input name="shrani" type="submit" id="shrani" value="Shrani" onclick="hideMe()" />
    <iframe id="myframe" width="100%" src="vnosPozicija.php" style="visibility:hidden;">Alternate I-frame content here!</iframe>

    ---

    I just made a few changes to yours (extra "=", missing ";", missing "}")... I used code similar to that to hide elements in a div tag.

    Hope that helps!

Similar Threads

  1. IFrame onclick event
    By PatrickP in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 06 Apr 2008, 05:03 PM
  2. firefox wont refresh an iframe
    By Littlened in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 22 Nov 2006, 03:19 PM
  3. Div popup always hidden behind IFrame
    By Setya in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 17 Mar 2006, 06:06 AM

Posting Permissions

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