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



Reply With Quote

Bookmarks