Results 1 to 3 of 3

Thread: iframe problem

  1. #1
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default iframe problem

    1) Script Title: iframe

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici.../dowiframe.htm

    3) Describe problem:

    hi, gurus,

    i have a page which has two frames, left.jsp and right.jsp.

    in the left.jsp, i have 4 links.
    <a href="right.jsp?id=1 target=right">first</a><br>
    <a href="right.jsp?id=2 target=right">second</a><br>
    <a href="right.jsp?id=3 target=right">third</a><br>
    <a href="right.jsp?id=4 target=right">fourth</a><br>

    and in the right.jsp, i have iframes,
    <iframe id="testiframe1" src = right1.jsp name="first" style="display:<%=(request.getParameter("id").equals("1"))?"":"none"%>" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>

    <iframe id="testiframe2" src = right2.jsp name="second" style="display:<%=(request.getParameter("id").equals("2"))?"":"none"%>" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>

    <iframe id="testiframe3" src = right3.jsp name="third" style="display:<%=(request.getParameter("id").equals("3"))?"":"none"%>" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>

    <iframe id="testiframe4" src = right4.jsp name="fourth" style="display:<%=(request.getParameter("id").equals("4"))?"":"none"%>" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>

    alright,
    so when i open right1.jsp, there is a textarea which i can type something into it.
    what i want is, if i typed something in the right1.jsp, then i open right2.jsp. and when i open back right1.jsp, the text are still there.

    i heard that it can be done in iframe, but it refresh everytime i open back the right1.jsp.
    is it possible to make right1.jsp to not refreshing?

    thank you.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    First off, this has nothing to do with the script you mention that I can see. And I think you might be confusing the server side language - jsp, with the client side language - javascript. Javascript is covered in these forums but not jsp.

    There are two basic approaches to what I think you are talking about:

    1) Once data has been inserted into a textarea on a page, don't reload it.

    Or:

    2) Recall the previously loaded data each time the page is loaded.

    Javascript can do either but, since I see you are using jsp, I would think that it could do #2 above and that would be the best approach as, it would work for folks even if they had javascript disabled.

    I don't know enough about jsp to advise you on specifics. A jsp forum would probably be brimming with folks that could help you though as, this is a basic operation in any server side language such as jsp, PHP, asp, etc.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for replying.

    i actually done something on that and it is working.
    the below is the source.

    <html>
    <head>
    <script language="Javascript">
    var iframe1;
    var iframe2;

    function test()
    {
    iframe1=document.createElement("iframe");
    iframe1.name="iframe1";
    iframe1.style.display="";
    iframe1.src="right1.html";
    iframe1.height="100%";
    iframe1.width="100%";
    document.body.appendChild(iframe1);

    iframe2=document.createElement("iframe");
    iframe2.name="iframe2";
    iframe2.style.display="none";
    iframe2.src="right2.html";
    iframe2.height="100%";
    iframe2.width="100%";
    document.body.appendChild(iframe2);
    }

    function call(id)
    {
    if(id=='1')
    {
    iframe1.style.display="";
    iframe2.style.display="none";
    }
    else if(id=='2')
    {
    iframe1.style.display="none";
    iframe2.style.display="";
    }
    }

    </script>
    </head>
    <body onLoad="test();">
    </body>
    </html>

    so when i call
    javascript:void(call(1));
    the iframe1 will come out and iframe2 will hide.

    My previous problem is solved then.
    but then i met another problem.

    my right1.html source:

    <html>
    <body>
    <a href="http://www.yahoo.com" target="iframe2">iframe2</a>
    </body>
    </html>

    when i click this link, a new window is pop out and load yahoo.
    I wonder why is it open in new window but not in second iframe.

    thanks.

Bookmarks

Posting Permissions

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