PDA

View Full Version : Help required regarding Search related to PDF



Achyuta S
07-20-2005, 02:14 PM
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

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