PDA

View Full Version : Script working/not working in Firefox



SawnDiddle
03-26-2008, 11:18 PM
I have http://scriptasylum.com/misc/percent_bar/percent_bar.html on http://newsalesparadigm.com/expediter/pretest.php

Now, on scriptasylum's site, it works, but when I use it, it doesn't work in firefox. Works fine in IE, can anyone tell me why it is doing this?

maishatsana
03-27-2008, 06:08 AM
Hello,

IE works with percentages and mozilla works with pixels. Try giving pixel value u run it in firefox.

Thanks & Regards

Maishat Sana

codeexploiter
03-27-2008, 07:23 AM
Two problems in your page:

1. You need to include the following script file inclusion at the top of your page. The <head> section is a good place to do that.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Expediter</title>

<link href="pretest.php_files/style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="percent_bar.js"></script>
</head>


Plz note that the above is your source I just copied it to make my point.

(2) You need to adjust the JavaScript a little bit in the percent_bar.js file



function clipid(id,t,r,b,l){

if(ns4){
id.clip.left=l;
id.clip.top=t;
id.clip.right=r;
id.clip.bottom=b;
}else id.style.width = r + "%";
}

I've highlighted the change I've made if you specify the CSS dimension property like width, height, etc if the value is a non-zero then you need to specify the measure in which you need to set the property for example 'px', '%', 'em', etc. In this case I've used '%' but if you want you can set it to 'px' once you do that the script will start working.