Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only Returns -1

Status
Not open for further replies.

fmrock

Programmer
Sep 5, 2006
510
US
Hey everyone, I dont work with javascript that much and have looked all over for a solution. I am using an activeX plugin that uses JS to interact with the control.

The activeX allows Tiff files to be viewed in IE. I am wanting to have a set of lables display something like "Page 1 of 10".

Below you will see the code the fendor provided for next page/previous page. I also read there help file and says to use "BITIFF.GetNumberOfImagesInTiffFile" to get the number of pages. Do you see anything with the JS that would allways bring back TotalNumberofPages = "-1"?


Code:
	function OnNext()
	{
		PageNum=PageNum+1;
		setLabelText("lblCurrentPage", PageNum);		
		var hDib = BITIFF.LoadTiffIntoDIB(LocalFile, PageNum, false);
		BIDISP.hDib = hDib;
		if(PageNum>0)
			PreviousPage.style.visibility="visible";
		if(PageNum>=BITIFF.GetNumberOfImagesInTiffFile(LocalFile)-1)
			NextPage.style.visibility="hidden";
		else			
			NextPage.style.visibility="visible";

	}	
	function OnPrevious()
	{
		PageNum=PageNum-1;
		setLabelText("lblCurrentPage", PageNum);			
		var hDib = BITIFF.LoadTiffIntoDIB(LocalFile, PageNum, false);
		BIDISP.hDib = hDib;
		if(PageNum<=0)
			PreviousPage.style.visibility="hidden";
		else			
			PreviousPage.style.visibility="visible";
		if(PageNum<BITIFF.GetNumberOfImagesInTiffFile(LocalFile)-1)
			NextPage.style.visibility="visible";
	}
	function OnLoad()
	{
		PreviousPage.style.visibility="hidden";
		BITIFF.DownloadImageFileURL(FilePath, LocalFile);
		
		var TotalNumberofPages = BITIFF.GetNumberOfImagesInTiffFile(LocalFile);
		
		setLabelText("lblCurrentPage", "1");
		setLabelText("lblLastPage", TotalNumberofPages);
			
	}
 
Did you try alerting what BITIFF.GetNumberOfImagesInTiffFile(LocalFile) returns? Maybe it's not a javascript issue but an issue with the ActiveX.

Cheers,
Dian
 
I am sure its a timing issue. the tiff file takes a few to download. I put an alert in the next page function and it msgs the page count.

Not sure what to do now to get wait until the file is completely downloaded.
 
Found a function built into the control to tell when the file is complete.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top