...

View Full Version : javascript working only in Mac osx and not on PC



jackam1
08-08-2006, 04:47 PM
Hi
The following code works perfectly(apart from one little problem which we can forget for the time being) on Mac osx, but will not work on pc or mac os9.
I was lucky enough for some one to write the javascript code for me, which I thought it was working fine, until I came to test it on pc.
On PC it has two problems:

1) When you choose the firstdrop down list the second list is supposed to get popluated which it doesn't.

1a) similarly when you choose 2nd drop down, the third one is supposed to get populated. These two problems, I very much succpect are related. If you solve one you ahve solved the other.

2) Again on PC the the values that need to be calculated and sown are not getting displayed.
after entering vales in red, teh green ones are supposed to be calculated automaically. it works fine agian on mac osx , but not on pC.

With my limited knowledge I am assuming its a browser compatibilty problem or maybe a syntax error that soem operating system will ignore but others can be strict.
Your help is much appreciated. The code pasted is not all the data, but for teh sake of simplicity I have included just the first choice numbers.

Your help is very much apprecaited.
As alot of work has gone into this I feel it is a shame to abandon this project as I am so close to getting it to work.
Thanks guys.


code:


<html>
<head>


<meta http-equiv="Content-Type" content="text/html; ">
<title>Pulley Calculation</title>
<style type="text/css" media="screen">

h1 {font-family: sans-serif; border-bottom: 0.125em solid #F33;
margin-bottom: 0;}
td.lbl {font-weight: bold; text-align: right;}
td {padding:0.25em 1px;}
tr.required td.lbl {background: #FCC; border-left:0.5em solid red;} /* a light red */
tr.required td.inp { font-weight: bold; text-align:center;}


td.lbl {background:#CFC; border-left:0.5em solid green;}

td.inp {color:red; }
div#submitarea {text-align:center;margin-top:1em; padding-top:1em;}

input:focus {background:yellow; }
</style>

<SCRIPT language="JavaScript">

var b16;
//var cd1;

function calculate()
{




var sel1=maths.stage1;





}

</SCRIPT>
</head>

<body>

<br>


<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/

var R1ip,R2ip;

function Populate2(obj){
R1ip=document.getElementById('R1');
R2ip=document.getElementById('R2');
var p1ip=document.getElementById('P1');
var p2ip=document.getElementById('P1');
R1ip.value='';
R2ip.value='';




z1=Number(maths.nosmallpulley.value);
z2=Number(maths.nolargepulley.value);
cd1=Number(maths.cd.value);
pit=(obj.value.split('|')[0]);



p1ip.value=(z1*(obj.value.split('|')[0])/Math.PI).toFixed(3);
lp.value=(z2 *(obj.value.split('|')[0])/Math.PI).toFixed(3);



thirdbox= (cd1*2) +( (z1+z2) *(pit/2)) + ( (z2-z1)* (pit/Math.PI ) * (z2-z1)* (pit/Math.PI ) ) * (1/(4*cd1));
tbl.value= thirdbox.toFixed(3);


//fourthbox=z1;
//ncd.value= fourthbox.toFixed(3);




var blts=obj.value.split('|')[1].split(',');
var sel2=document.getElementById('Sel2');
sel2.options.length=1;
for (var zxc0=0;zxc0<blts.length;zxc0++){
if (blts[zxc0].length>0){;
var opt=Belts[parseInt(blts[zxc0])];
sel2.options[zxc0+1]=new Option(opt[0],opt[1],true,true);
}
}
sel2.selectedIndex=0;
}

function Populate3(obj){
R1ip.value='';
R2ip.value='';
var ary=window[obj.value];
var sel3=document.getElementById('Sel3');
sel3.options.length=1;
for (var zxc0=0;zxc0<ary.length;zxc0++){
sel3.options[zxc0+1]=new Option(ary[zxc0][0],ary[zxc0][1],true,true);
}
sel3.selectedIndex=0;
}

function PopulateR1R2(obj){
R1ip.value='';
R2ip.value='';
if (obj.selectedIndex==0){ return; }
var vals=obj.value.split(',');

//R1ip.value=vals[0]*2;


k= (vals[0]/4) -( (z2+z1)*pit/8);
m1=((z2-z1)*pit/Math.PI) * ((z2-z1)*pit/Math.PI) ;
fourthbox= k + Math.sqrt( k*k- ( m1 /8 ) );
R1ip.value=fourthbox.toFixed(3)



page770= z1/180;
page771= (180/Math.PI)* Math.acos( ((z2-z1)*pit) / (2*Math.PI *Number(R1ip.value)) );

//page771= (180/Math.PI)*Math.acos(
((z2-z1)*pit) / (2*Math.PI *Number(52.689)
);


//page771= (180/Math.PI)*Math.acos(
((z2-z1)*pit) / (2*Math.PI *Number(R1ip.value)
);

fifthbox=page771*page770;
//*page771;


R2ip.value=fifthbox.toFixed(3);


//R1ip.value=vals[0];
//R2ip.value=vals[1];
}

var Belts=[];
Belts[0]=['Belt 0','List1'];
Belts[1]=['T2.5','List2'];
Belts[2]=['HTD3','List8'];
Belts[3]=['T5','List3'];
Belts[4]=['T5/DL','List4'];
Belts[5]=['AT5','List10'];
Belts[6]=['HTD5','List11'];
Belts[7]=['HTD8','List9'];
Belts[8]=['T10','List5'];
Belts[9]=['T10/DL','List6'];
Belts[10]=['AT10','List12'];
Belts[11]=['HTD14','List13'];
Belts[12]=['T20','List7'];
Belts[13]=['AT20','List14'];
Belts[14]=['MP','List22'];
Belts[15]=['MXL','List15'];
Belts[16]=['XL','List16'];
Belts[17]=['XL/DL','List17'];
Belts[18]=['L','List18'];
Belts[19]=['L/DL','List19'];
Belts[20]=['H','List20'];
Belts[21]=['H/DL','List21'];

var List1=[];
List1[0]=['List 1 - 0','111,21']
List1[1]=['List 1 - 1','123,1234']
List1[2]=['List 1 - 2','2344,456']
List1[3]=['List 1 - 3','567,342']

var List2=[];
List2[0]=['55','55,6666']
List2[1]=['120','120,6666']
List2[2]=['145','145,2222']
List2[3]=['160','160,4444']
List2[4]=['177.5','177.5,4444']
List2[5]=['180','180,4444']
List2[6]=['182.5','182.5,4444']
List2[7]=['200','200,4444']
List2[8]=['210','210,4444']
List2[9]=['230','230,4444']
List2[10]=['245','245,4444']
List2[11]=['265','265,4444']
List2[12]=['285','285,4444']
List2[13]=['290','290,4444']
List2[14]=['305','305,4444']
List2[15]=['317.5','317.5,4444']
List2[16]=['330','330,4444']
List2[17]=['380','380,4444']
List2[18]=['420','420,4444']
List2[19]=['480','480,4444']
List2[20]=['492.5','492,4444']
List2[21]=['500','500,4444']
List2[22]=['540','540,4444']
List2[23]=['600','600,4444']
List2[24]=['620','620,4444']
List2[25]=['650','650,4444']
List2[26]=['680','680,4444']
List2[27]=['915','915,4444']
List2[28]=['950','950,4444']
List2[29]=['1300','1300,4444']
List2[30]=['1750','1750,4444']


/*]]>*/
</script>




<form name ="maths">

<h1>Pulley centre Calculation</h1>
<table cellspacing="0">
<tr class="required">
<td class="lbl">No of Teeth in Small Pulley </td>
<td class="inp"><input type="text" name="nosmallpulley" size="20" maxlength="8" onBlur="calculate();"></td>
</tr>
<tr class="required">
<td class="lbl">No of Teeth in Large Pulley </td>
<td class="inp"><input type="text" name="nolargepulley" size="20" maxlength="8" onBlur="calculate();"> </td>
</tr>


<tr class="required">
<td class="lbl">Centre Distant ( mm </td>
<td class="inp"><input type="text" name="cd" size="20" maxlength="8" onBlur="calculate();"></td>
</tr>

<tr class="required">
<td class="lbl">Pitch ( mm) </td>
<td class="inp">
<select onchange="Populate2(this);" >
<option value=" |" >Belt Size</option>
<option value="2.5|1" >2.5 mm</option>
<option value="3|2" >3 mm</option>
<option value="5|3,4,5,6" >5 mm</option>
<option value="8|7" >8 mm</option>
<option value="10|8,9,10" >10 mm</option>
<option value="14|11" >14 mm</option>
<option value="20|12,13" >20 mm</option>
<option value="2.032|14,15" >2.032 mm (0.08")</option>
<option value="5.08|16,17" >5.08 mm (0.20")</option>
<option value="9.525|18,19" >9.525 mm (3/8")</option>
<option value="12.7|20,21" >12.7mm (1/2")</option>

</select>
</td>
</tr>




<tr>
<td class="lbl">
Small Pulley PCD ( mm)</td>

<td class="inp">

<input id="P1" >
</td>

</tr>




<tr>
<td class="lbl">
Large Pulley PCD ( mm)</td>
<td>
<input id="lp" ></td>
</tr>


<tr>
<td class="lbl">
Theoretical Belt length ( mm)</td>
<td class="inp">
<input id="tbl" >
</td>
</tr>

<tr class="required">
<td class="lbl">
Please choose nearest standard Belt Length (mm)</td>
<td class="inp"
<select id="Sel2" onchange="Populate3(this);" >
<option value="" >Matched Belts</option>
</select>

<select id="Sel3" onchange="PopulateR1R2(this);">
<option value="X" >Belt Lengths</option>
</select>




</td>
</tr>


<tr>
<td class="lbl">
Nominal Centre Distance ( mm)</td>
<td class="inp">
<input id="R1" >
</td>
</tr>


<tr>
<td class="lbl">
Number of Teeth in Mesh ( mm)</td>
<td class="inp">
<input id="R2" >
</td>
</tr>

</table>

<div id="submitarea">
<input type="submit" value="Reset"><br>
Filelds highlighted with red labels <strong> must</strong> be filled in
</div>


</form>


</body>
</html>

jack

Kor
08-08-2006, 05:03 PM
It is not a matter if operating sistem (javascript has nothing to do with OS) but a matter of browser type... What browsers have u used?

jackam1
08-08-2006, 05:12 PM
Hi
The apple mac osx browser I use is Sarafi, which works just fine.
The ones that don't work are both Internet explorer, mac os 9, and pc version.
thanks
jack

felgall
08-09-2006, 02:32 AM
Does it work in Firefox and Opera (on PC and Mac)? If it works there then that will mean that the problem is specific to IE (which only runs on Windows). Most IE Javascript problems are caused by using variable names that match with the names of fields in your HTML which IE kindly maps to variables for you overwriting whatevefr you were trying to use those variables for.

Bill Posters
08-09-2006, 07:51 AM
IE (which only runs on Windows)
:sigh:

Care to rephrase that?

felgall
08-09-2006, 08:16 AM
Microsoft declared IE on the Mac officially dead in 2003 after many years of not maintaining or updating it. The only platform on which a supported version of Internet Explorer runs is Windows and even that version is several years behind other browsers in its support of web pages.

Bill Posters
08-09-2006, 08:30 AM
Unsupported doesn't mean non-existent.
It's not as if IE5/Mac magically disappeared from the apps folder of its users on the day that MS finally and officially discontinued support.
Whether you care to acknowledge it or not, there are markets where supporting IE5/Mac could be considered worthwhile.

Don't get me wrong. I wish IE5/Mac didn't exist - or rather, I wish that it had zero users. But the fact is that it still has users, the numbers of which can stray into significance for certain types of projects.

Suggesting that it doesn't exist is less to do with the actual landscape of in-use browsers and more to do with putting forward your views on its worthiness
If that's your view, then say that. What you actually said could easily mislead others for whom IE5/Mac users could be a significant amongst their target audience - something you (and possibly even they) may not be aware of.

Making authors aware that it exists and that it's still in use in certain quarters allows them to make more informed decisions about whether or not to support it, rather than innocently believing the statements of those who have been economical with the truth - possibly at the cost of some success to the author's sites.

;)


(How many more times do I have to slap your wrists over your statements about IE5/Mac?) ;) ;)

Kor
08-09-2006, 02:21 PM
For instance:

var sel1=maths.stage1;
should be
var sel1=document.maths.stage1;

Check whether all the objects which are refered by name, have name, and if refere by id, have an id along the name.

I am not sure if media="screen" CSS works properly on IE/Mac

Speaking about IE/Mac... The fact that there are still few mad people which have not installed other browser than IE/Mac has no relevance. There are so many bugs in that browser so that in fact I wonder if any CSS/javascript code will run properly on it. So that the problem lays like that: If the key (IE/Mac) does not fit with the lock (standard, normal HTML/CSS/Javascript code), you do not change the lock, you change the key.

Bill Posters
08-10-2006, 07:07 AM
Speaking about IE/Mac... The fact that there are still few mad people which have not installed other browser than IE/Mac has no relevance.
That's just plain ignorant. Some markets still have a substantial IE5/Mac userbase, not huge, but significant enough to warrant support if you're aiming for good coverage within that target audience.
(It's actually quite ironic that the site type which commonly comes in for the 'IE5/Mac doesn't matter' attitude are the designer's own portfolio sites. Such sites, particularly those of freelancers, are frequently browsed by other designers and design companies which are possibly open to using freelancers. The arts, print and design sector is one area which still has a disproportionate number of IE5/Mac users. So, by building a portfolio site which dismisses IE5/Mac, you are actually doing more potential damage to the success of a site than you would if the site were aimed at a wider, more general audience.
I continue to pick up alot of freelance sub-contracting from another design company which at the time they first encountered me, were amongst those still using IE5/Mac. Had I not bothered to make my site usable for users of that browser, I could well have cut myself off from a significant source of income. This was at a time when people had already been advising me not to worry about that browser.
Of course, it could require as few as one IE5/Mac user to warrant support if that user happens to be the client, because, no matter how much we try to assure them that the browser which they're using is so rarely used today, they still remain unconvinced that they're getting a good service when it doesn't include support for the browser they're using.)


There are so many bugs in that browser so that in fact I wonder if any CSS/javascript code will run properly on it.
Statements such as that really make me wonder if you've ever actually used it or if you're simply falling in line with the negative hype surrounding IE5/Mac much of which is made out of a lack of knowledge, rather than an excess of it. There seems to be this idea that IE5/Mac is a browser absolutely riddled with site-eating bugs and it predominantly seems to be an idea that's propagandised by developers who think that unsupported means non-existent or Windows users who have simply never used it.

IE5/Mac was ahead of its time when it was released and consequently still does a respectable job in most cases on well built sites today.
I've never had a site go irreparably tits up in IE5/Mac.

More often than not, IE5/Mac will display a page workably close to other, more modern, browsers. Sure its CSS support has some issues, but few that will kill a layout stone dead. Its js may not include support for the more recent W3C DOM methods, but in many cases, there are alternative such as DOM 0 which we could use if giving IE5/Mac the js is critical.
That said, it's commonly understood that sites today should be built so as not to be reliant upon js to remain usable (v-a-v progressive enhancement).
So long as we use object detection to withhold our scripts from less capable browsers, we can rest assured that our sites remain entirely usable and accessible to those with browsers which don't support our favoured javascripts.


If the key (IE/Mac) does not fit with the lock (standard, normal HTML/CSS/Javascript code), you do not change the lock, you change the key.
Now try that again using IE6 as 'the key' and see if your rule of thumb still holds up.

A great many times IE6 doesn't fit 'the lock', but I'd be surprised to hear you genuinely suggest that all IE6 user should be expected to change their browsers to fit your compliant code.
In the real world, it's a question of numbers - and, in the real world there are cases where the numbers suggest that supporting IE5/Mac can be beneficial to a site's success.
As considered as you might think it sounded, the above statement about locks and keys is less of an intolerance of non-compliant browsers, but simply a view dismissing IE5/Mac.

Calling for people to change to a better browser, particularly on a web dev forum where it's unlikely that anyone still uses IE5/Mac, is largely a pointless act of posturing. It's preaching to the choir.
Still, if you feel up to going out there and talking to those who are actually using the browser, then more power to you.
Just don't kid yourself that you're actually achieving anything by informing a bunch of people who already know that better browsers exist.

The fact remains that if a certain author is targeting a certain audience, then it is their stats (projected or actual) which should dictate whether or not IE5/Mac warrants support. Writing off any particular browser wholesale, whilst possibly something the cool kids do, is also negligent - and certainly not an attitude which knowledgable, responsible developers should be encouraging.

A number of times I've worked on projects where IE5/Mac support wasn't seen as specifically warranted, but the layout was either already fine in that browser or was within a few minutes work of being so, that I felt that those few extra minutes were worth throwing in.
It really makes me wonder what's so different about the way that I work that I've never found rolling in IE5/Mac support so problematic as to develop such a deep-seated dislike of that browser.

I find the fact that some people apparently don't know and yet, for some reason, still feel sufficiently informed to form and propagate an opinion a little disturbing. Perhaps if we all spent a little less time 'wondering' and a little more time actually finding out...

felgall
08-10-2006, 08:23 AM
Actually trying to continue to support IE/Mac users with web pages means using 20th century coding techniques since the browser hasn't been updated in about 8 or more years. The newer Mac operating systems would have Safari installed as the preferred browser rather than IE.

While it is realistic to make sure that your web page will be usable on any web browser it would not be worth the time to provide special code to specifically handle that browser unless a large percentage of your visitors are using obsolete Macs running outdated operating systems - say if the percentage was higher than 0.1% of your total visitors.

Bill Posters
08-10-2006, 10:32 AM
Actually trying to continue to support IE/Mac users with web pages means using 20th century coding techniques
Strange that. I've never needed to implement a '20th century coding technique' for the sake of IE5/Mac.
The CSS I use is as 21st Century as IE6 will allow it to be.
The js is predominantly 21st century with the exception of a few methods which I consider to be more practical in terms of supporting browsers besides IE5/Mac.
I endeavour to ensure that site on which I work remain indepedent of js, implementing only in ways which enhances the site for those who have it, without robbing those who don't of access to parts of the site.

As I've pointed out to you before, your own sites appear pretty close to perfect in IE5/Mac, save for one or two questionable development decisions.

If I'm being brutal, I could point out that your own code is fairly well loaded with '20th century coding techniques', which makes me wonder why you claim to have such an issue with it.

The '8 or more years' figure is fairly wide of the mark, the truth being less than 5 years [Dec 2001].


Like I said, there's alot of ignorance about that browser, being spread around by people who should know better.

jackam1
08-10-2006, 11:05 AM
Hi
Thanks for all your comments.
We are getting abit side tracked here.
I have tested on windows xp using firefox and it also works just fine.
So the only one not working is on M$ Internet explorer.
I am nto too much bothered about apple mac os 9, as not many of our customers have that late opearting system.
I will be happy if it works in internet explorer.
I will test the advice you ahve given and change the coding to see if it works.
Please make yoru advice simple to follow as I am new to javascript.
Thanks for your time and advice
jack

Kor
08-10-2006, 02:33 PM
If I'm being brutal
Not really. Just stubborn. When a man is in love, he does not see the defects of his lover.:D No one wants to divorce you. You are free to use whichever browser you like. But shall not complain if something might go wrong with it from time to time. Don't blame the new languages, it is not their fault.

Bill Posters
08-10-2006, 03:47 PM
Where did I say that I use IE5/Mac (for anything other than testing)?
Don't mistake my defense of fact lead you to think that I use or even like IE5/Mac.
I haven't used it as a regular, or even irregular, browser for many years.

I understand IE5/Mac's limitations. It would even appear that I understand them - or at least, am prepared to understand them - much better than certain others here. I've never wrongly blamed code when IE5/Mac has been the issue, nor am I likely to do so.

It bothers and frustrates me when people who should know better pass out advice on issues about which they know little or nothing - and in doing so propogate misleading advice and incorrect information.

It probably peeves me a little more as the ignorance towards this particular issue seems to be regurgitated by a few whom I'd come to consider to be amongst the better informed members here at CF - and whose words are likely to go unquestioned by those who are seeking advice from members who are further along the learning curve.


Fwiw, I'd expect (and welcome) others to come down on me just as hard if I were being that sloppy. ;)

Kor
08-10-2006, 03:52 PM
ok ok... let's make peace! I agree that "people who should know better pass out advice on issues about which they know little or nothing - and in doing so propogate misleading advice and incorrect information." And this category might includes you as well...

Bill Posters
08-10-2006, 04:04 PM
If it does, then, as I said, I'd expect anyone who sees me do it to be kicking my backside too.
I think I've managed to do a good job of avoiding that particular pitfall, but feel free to correct me.

Still, I try to minimise the chances of that happening by knowing my limitations. ;)

jackam1
08-10-2006, 04:29 PM
Problem Solved.
At least on pc version of internet explorer. i don't think i will bother fixing it for mac os9 version of internet explorer and only handful of people use it.
Apparently the problem was that the variable declaration has to be put in this was:

e.g. var tblip=document.getElementById('tbl');

Don't ask me why!!
thnaks for all your help and discussions.
ajck

Kor
08-10-2006, 04:43 PM
if an element has an id, is to be found as
document.getElementById('myid')
not as simple
myid

But it surprises me that you said the code worked in Mozilla and not in IE. Should have been inverse, as IE can refere (incorrectly) an object directly by it's id or name, like
myid
or
window['myid']

vwphillips
08-10-2006, 05:03 PM
Jack

as I pointed out previous

your HTML has many errors

and ID/variable names must be unique

I have fixed most


<html>
<head>


<meta http-equiv="Content-Type" content="text/html; ">
<title>Pulley Calculation</title>
<style type="text/css" media="screen">

h1 {font-family: sans-serif; border-bottom: 0.125em solid #F33;
margin-bottom: 0;}
td.lbl {font-weight: bold; text-align: right;}
td {padding:0.25em 1px;}
tr.required td.lbl {background: #FCC; border-left:0.5em solid red;} /* a light red */
tr.required td.inp { font-weight: bold; text-align:center;}


td.lbl {background:#CFC; border-left:0.5em solid green;}

td.inp {color:red; }
div#submitarea {text-align:center;margin-top:1em; padding-top:1em;}

input:focus {background:yellow; }
</style>

<SCRIPT language="JavaScript">

var b16;
//var cd1;

function calculate()
{




var sel1=maths.stage1;





}

</SCRIPT>
</head>

<body>

<br>


<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/

var R1ip,R2ip;

function Populate2(obj){
R1ip=document.getElementById('R1');
R2ip=document.getElementById('R2');
var p1ip=document.getElementById('P1');
var p2ip=document.getElementById('P1');
R1ip.value='';
R2ip.value='';




z1=Number(maths.nosmallpulley.value);
z2=Number(maths.nolargepulley.value);
cd1=Number(maths.cd.value);
pit=(obj.value.split('|')[0]);



p1ip.value=(z1*(obj.value.split('|')[0])/Math.PI).toFixed(3);
p2ip.value=(z2 *(obj.value.split('|')[0])/Math.PI).toFixed(3);



thirdbox= (cd1*2) +( (z1+z2) *(pit/2)) + ( (z2-z1)* (pit/Math.PI ) * (z2-z1)* (pit/Math.PI ) ) * (1/(4*cd1));
document.getElementById('tbl').value= thirdbox.toFixed(3);


//fourthbox=z1;
//ncd.value= fourthbox.toFixed(3);




var blts=obj.value.split('|')[1].split(',');
var sel2a=document.getElementById('Sel2');
sel2a.options.length=1;
for (var zxc0=0;zxc0<blts.length;zxc0++){
if (blts[zxc0].length>0){;
var opt=Belts[parseInt(blts[zxc0])];
sel2a.options[zxc0+1]=new Option(opt[0],opt[1],true,true);
}
}
sel2a.selectedIndex=0;
}

function Populate3(obj){
R1ip.value='';
R2ip.value='';
var ary=window[obj.value];
var sel3a=document.getElementById('Sel3');
sel3a.options.length=1;
for (var zxc0=0;zxc0<ary.length;zxc0++){
sel3a.options[zxc0+1]=new Option(ary[zxc0][0],ary[zxc0][1],true,true);
}
sel3a.selectedIndex=0;
}

function PopulateR1R2(obj){
R1ip.value='';
R2ip.value='';
if (obj.selectedIndex==0){ return; }
var vals=obj.value.split(',');

//R1ip.value=vals[0]*2;


k= (vals[0]/4) -( (z2+z1)*pit/8);
m1=((z2-z1)*pit/Math.PI) * ((z2-z1)*pit/Math.PI) ;
fourthbox= k + Math.sqrt( k*k- ( m1 /8 ) );
R1ip.value=fourthbox.toFixed(3)



page770= z1/180;
page771= (180/Math.PI)* Math.acos( ((z2-z1)*pit) / (2*Math.PI *Number(R1ip.value)) );

//page771= (180/Math.PI)*Math.acos(
((z2-z1)*pit) / (2*Math.PI *Number(52.689)
);


//page771= (180/Math.PI)*Math.acos(
((z2-z1)*pit) / (2*Math.PI *Number(R1ip.value)
);

fifthbox=page771*page770;
//*page771;


R2ip.value=fifthbox.toFixed(3);


//R1ip.value=vals[0];
//R2ip.value=vals[1];
}

var Belts=[];
Belts[0]=['Belt 0','List1'];
Belts[1]=['T2.5','List2'];
Belts[2]=['HTD3','List8'];
Belts[3]=['T5','List3'];
Belts[4]=['T5/DL','List4'];
Belts[5]=['AT5','List10'];
Belts[6]=['HTD5','List11'];
Belts[7]=['HTD8','List9'];
Belts[8]=['T10','List5'];
Belts[9]=['T10/DL','List6'];
Belts[10]=['AT10','List12'];
Belts[11]=['HTD14','List13'];
Belts[12]=['T20','List7'];
Belts[13]=['AT20','List14'];
Belts[14]=['MP','List22'];
Belts[15]=['MXL','List15'];
Belts[16]=['XL','List16'];
Belts[17]=['XL/DL','List17'];
Belts[18]=['L','List18'];
Belts[19]=['L/DL','List19'];
Belts[20]=['H','List20'];
Belts[21]=['H/DL','List21'];

var List1=[];
List1[0]=['List 1 - 0','111,21']
List1[1]=['List 1 - 1','123,1234']
List1[2]=['List 1 - 2','2344,456']
List1[3]=['List 1 - 3','567,342']

var List2=[];
List2[0]=['55','55,6666']
List2[1]=['120','120,6666']
List2[2]=['145','145,2222']
List2[3]=['160','160,4444']
List2[4]=['177.5','177.5,4444']
List2[5]=['180','180,4444']
List2[6]=['182.5','182.5,4444']
List2[7]=['200','200,4444']
List2[8]=['210','210,4444']
List2[9]=['230','230,4444']
List2[10]=['245','245,4444']
List2[11]=['265','265,4444']
List2[12]=['285','285,4444']
List2[13]=['290','290,4444']
List2[14]=['305','305,4444']
List2[15]=['317.5','317.5,4444']
List2[16]=['330','330,4444']
List2[17]=['380','380,4444']
List2[18]=['420','420,4444']
List2[19]=['480','480,4444']
List2[20]=['492.5','492,4444']
List2[21]=['500','500,4444']
List2[22]=['540','540,4444']
List2[23]=['600','600,4444']
List2[24]=['620','620,4444']
List2[25]=['650','650,4444']
List2[26]=['680','680,4444']
List2[27]=['915','915,4444']
List2[28]=['950','950,4444']
List2[29]=['1300','1300,4444']
List2[30]=['1750','1750,4444']


/*]]>*/
</script>




<form name ="maths">

<h1>Pulley centre Calculation</h1>
<table cellspacing="0">
<tr class="required">
<td class="lbl">No of Teeth in Small Pulley </td>
<td class="inp"><input type="text" name="nosmallpulley" size="20" maxlength="8" onBlur="calculate();"></td>
</tr>
<tr class="required">
<td class="lbl">No of Teeth in Large Pulley </td>
<td class="inp"><input type="text" name="nolargepulley" size="20" maxlength="8" onBlur="calculate();"> </td>
</tr>


<tr class="required">
<td class="lbl">Centre Distant ( mm </td>
<td class="inp"><input type="text" name="cd" size="20" maxlength="8" onBlur="calculate();"></td>
</tr>

<tr class="required">
<td class="lbl">Pitch ( mm) </td>
<td class="inp">
<select onchange="Populate2(this);" >
<option value=" |" >Belt Size</option>
<option value="2.5|1" >2.5 mm</option>
<option value="3|2" >3 mm</option>
<option value="5|3,4,5,6" >5 mm</option>
<option value="8|7" >8 mm</option>
<option value="10|8,9,10" >10 mm</option>
<option value="14|11" >14 mm</option>
<option value="20|12,13" >20 mm</option>
<option value="2.032|14,15" >2.032 mm (0.08")</option>
<option value="5.08|16,17" >5.08 mm (0.20")</option>
<option value="9.525|18,19" >9.525 mm (3/8")</option>
<option value="12.7|20,21" >12.7mm (1/2")</option>

</select>
</td>
</tr>




<tr>
<td class="lbl">
Small Pulley PCD ( mm)</td>

<td class="inp">

<input id="P1" >
</td>

</tr>




<tr>
<td class="lbl">
Large Pulley PCD ( mm)</td>
<td>
<input id="lp" ></td>
</tr>


<tr>
<td class="lbl">
Theoretical Belt length ( mm)</td>
<td class="inp">
<input id="tbl" >
</td>
</tr>

<tr class="required">
<td class="lbl">
Please choose nearest standard Belt Length (mm)</td>
<td class="inp" >
<select id="Sel2" onchange="Populate3(this);" >
<option value="" >Matched Belts</option>
</select>

<select id="Sel3" onchange="PopulateR1R2(this);">
<option value="X" >Belt Lengths</option>
</select>




</td>
</tr>


<tr>
<td class="lbl">
Nominal Centre Distance ( mm)</td>
<td class="inp">
<input id="R1" >
</td>
</tr>


<tr>
<td class="lbl">
Number of Teeth in Mesh ( mm)</td>
<td class="inp">
<input id="R2" >
</td>
</tr>

</table>

<div id="submitarea">
<input type="submit" value="Reset"><br>
Filelds highlighted with red labels <strong> must</strong> be filled in
</div>

</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum