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!

Need Help getting code to work in Firefox

Status
Not open for further replies.

fmrock

Programmer
Sep 5, 2006
510
US
I am using a the blackice tiff viewer in my asp page. Everything works great in IE, but does not work in Firefox.

Here is the body tag code
Code:
<body onload="javascript:OnLoad()">

Script in head tag for the different features.
Code:
<script language="JavaScript" type="text/javascript">
    var PageNum=0;
	var FilePath="<%=chrChartName%>";
	var LocalFile="c:\\test.tif";
	var zoom = .6;
	var zoomRate = 0.1;	
	
	function OnScale(what)
	{
	  switch(what.selectedIndex) {
		case 0:
		  OnSWNormal();
		break;
		case 1:
		  OnSWdpi();
		break;
		case 2:
		  OnSWfitwidth();
		break;
		case 3:
		  OnSWfitheight();
		break;
		case 4:
		  OnSWfitwindow();
		break;	
	  }
	}

	function OnNext()
	{
		PageNum=PageNum+1;
		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;
		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()
	{
		BIDISP.ScaleMode = 1;
		BIDISP.ScrollBars = 3;
		BIDISP.ZoomWithKeyboard=0;
		BIDISP.Zoom = 0;	
//		BIDISP.CustomZoom = -0.57;		
		BIDISP.CustomZoom(zoom);			
		BIDISP.Mapping = 1;		
		PreviousPage.style.visibility="hidden";
		BITIFF.DownloadImageFileURL(FilePath, LocalFile);
	}

	function OnSWNormal()
	{
		BIDISP.ScaleMode = 1;
		BIDISP.ZoomWithKeyboard=1;
		BIDISP.Zoom = 1;
	}
	function OnSWdpi()
	{
		BIDISP.ScaleMode = 5;
		BIDISP.ZoomWithKeyboard=1;
		BIDISP.Zoom = 1;
	}
	function OnSWfitwidth()
	{
		BIDISP.ScaleMode = 2;
		BIDISP.ZoomWithKeyboard=0;
		BIDISP.Zoom = 0;

	}
	function OnSWfitheight()
	{
		BIDISP.ScaleMode = 3;
		BIDISP.ZoomWithKeyboard=0;
		BIDISP.Zoom = 0;
		
	}
	function OnSWfitwindow()
	{
		BIDISP.ScaleMode = 0;
		BIDISP.ZoomWithKeyboard=0;
		BIDISP.Zoom = 0;
	}

	function Onmagglasson()
	{
		if(magglasson.checked)
		{
			panning.style.visibility="hidden";
			panningtext.style.visibility="hidden";			
			BIDISP.Magnify = 1;
			BIDISP.ZoomWithKeyboard=0;
			BIDISP.Zoom = 0;

		}
		else
		{
			panning.style.visibility="visible";
			panningtext.style.visibility="visible";			
			BIDISP.Magnify = 0;		
			BIDISP.ZoomWithKeyboard=1;
			BIDISP.Zoom = 1;
		}
	}

	function OnPanning()
	{
		if(panning.checked)
		{
			BIDISP.Mapping = 1;
			BIDISP.ZoomWithKeyboard=0;
			BIDISP.Zoom = 0;
		}
		else
		{
			BIDISP.Mapping = 0;		
			BIDISP.ZoomWithKeyboard=0;
			BIDISP.Zoom = 0;
		}
	}
	
	function ZoomIn()
	{
		//BIDISP.ZoomIn();
		zoom *= 1+zoomRate;
		BIDISP.CustomZoom(zoom);
	}
	function ZoomOut()
	{
		//BIDISP.ZoomOut();
		zoom *= 1/(1+zoomRate);
		BIDISP.CustomZoom(zoom);
	}

	function FlipH()
	{
		var hDib = BIDIB.FlipDIBHorizontal(BIDISP.hDib);
		BIDISP.hDib = hDib;
	}
	function FlipV()
	{
		var hDib = BIDIB.FlipDIBVertical(BIDISP.hDib);
		BIDISP.hDib = hDib;
	}
	function Rotate90()
	{
		var hDib = BIDIB.RotateDIB270(BIDISP.hDib);
		BIDISP.hDib = hDib;
	}
	function Rotate180()
	{
		var hDib = BIDIB.RotateDIB180(BIDISP.hDib);
		BIDISP.hDib = hDib;
	}
	function Rotate270()
	{
		var hDib = BIDIB.RotateDIB90(BIDISP.hDib);
		BIDISP.hDib = hDib;
	}
	function Invert()
	{
		if(BIDISP.Invert)
			BIDISP.Invert=false;
		else
			BIDISP.Invert=true;
	}
	function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
	MM_reloadPage(true);
	

</script>


Here is the code in the page which will download the activeX if necessary.

Code:
	<object classid="clsid:1"><param name="LPKPath" value="tiff.LPK"></object> 
      <object id="BIDISP" width="100%" height="93%" classid="CLSID:1" codebase="tiff.cab"></object>
      <object id="BITIFF" width=1 height=1 classid="CLSID:1" codebase="tiff.cab"></object>
      <object id="BIDIB" width=1 height=1 classid="CLSID:1" codebase="tiff.cab"></object>

      <script language="JavaScript" type="text/javascript">
  		function BITIFF::URLLoadImageComplete(DIB)
		{
			BIDISP.hDib = DIB;
		}
		function BITIFF::URLDownloadImageFileComplete()
		{
			var hDib = BITIFF.LoadTiffIntoDIB("c:\\test.tif", 0, false);
			BIDISP.hDib = hDib;
		}
     </script>


The support for the activeX said it was only written and tested in IE. That I would need to do some editing to get this to work. Not really sure where to start of if anyone here could help point me in the right direction. Any help would be great.
 
P.S. Do you have the latest version?

Also, I notice their site says it works in Netscape... and if it works in NN, I'd be surprised if it doesn't work in Fx (so perhaps try NN first?)

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
What is the ActiveX plugin for firefox? Do I have to have that to get this to work with firefox?

We may be a version behind, but we are in the process of upgrading to get the newest version.

Also, feherke, I updated the code.
 
Also, downloaded netscape and the page acts exactly the same way.
 
Hi

According to my biased opinion, having ActiveX in other browser than Explorer is like running PHP directly in the browser : some people say it is possible. Personally I would not spend a second trying to make it work.

Feherke.
 
Thanks for the advice.

The project i am working on has to give the user the ability to view tiff images and then add notes though a webform into a database. Do you know any other way of viewing tiffs in a page other then an ActiveX?
 
Thanks Dan, I had found that but was looking on the Firefox website for a plugin.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top