Results 1 to 2 of 2

Thread: Help required regarding Search related to PDF

  1. #1
    Join Date
    Jul 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help required regarding Search related to PDF

    Hi ALL,

    This is regarding my previous posting on "Need to change the SRC atribute of an Iframe on button click".

    I have displayed a pdf file in an Iframe.

    Next, I have a textbox with some text (say 'pdf') in it. Now when I click a button, the SRC attribute in the Iframe should be concatenated with #search='pdf' in the end.

    I have implemented this through this code.

    <html>
    <body>

    <div>
    <IFRAME SRC="C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\jsp-examples\AcrobatDeveloperFAQ.pdf" ID="testiframe"
    NAME="testiframe" SCROLLING=yes WIDTH=450 HEIGHT=550 ALIGN=MIDDLE></IFRAME>
    </diV><br>

    <script language="javascript">

    function searchInPdf()
    {
    document.all.testiframe.src="AcrobatDeveloperFAQ.pdf#search="+"\""+txt1.value+"\"";
    alert(document.all.testiframe.src);
    }

    </script>

    <input type="text" name="txt1" value="">
    <input type="submit" name="btn1" value="Search" onclick="searchInPdf();" >

    </body>
    </html>

    Now, the PROBLEM I'm facing here is:

    When the page is loaded, I enter some text in the textbox & click the 'Search' button. The search results are displayed in the pdf file on the Iframe.

    But the second time(without refreshing the page) if I enter some text in the textbox & click on 'Search' nothing happens.

    Basically this works only when the page is refreshed/reloaded. Why is this so? Please post some solution for this issue ASAP.

    Thanks & Regards,
    Achyuta

  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

    That is what I was getting at with my use of blank.htm in my response to your previous post on this. Try modifying your button to take advantage of this technique:

    Code:
    <input type="submit" name="btn1" value="Search" onmousedown="document.all.testiframe.src='blank.htm'" onmouseup="searchInPdf();" >
    BTW, if yours works as you say it does, mine from my previous post will do the trick as well, and works cross browser, whereas yours only works in IE.
    Last edited by jscheuer1; 07-20-2005 at 02:38 PM.
    - John
    ________________________

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

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
  •