View Full Version : Help required regarding Search related to PDF

Achyuta S
07-20-2005, 02:14 PM

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.


<IFRAME SRC="C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\jsp-examples\AcrobatDeveloperFAQ.pdf" ID="testiframe"

<script language="javascript">

function searchInPdf()


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


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,

07-20-2005, 02:35 PM
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:

<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.