PDA

View Full Version : Problem with my coding....



Darkmirror
10-30-2009, 05:50 PM
Hi, I am making game calculator but i am having problem with coding...

.::Java script::.


<script language="javascript">
function temp(form)
{
var a = (form.DegF.value);
var b = (form.DegF2.value);
var c = (form.DegF3.value);
var d = (form.DegF4.value);
var e= (form.DegF5.value);
var f= (form.DegF6.value);
var g= (form.DegF7.value);
var h= (form.DegF8.value);
var i= (form.DegF9.value);
var j= (form.DegF10.value);
var k= (form.DegF11.value);
var l= (form.DegF12.value);
var m= (form.DegF13.value);
var n= (form.DegF14.value);
var o= (form.DegF15.value);
var aa= (Math.pow(a,3));
var bb= (Math.pow(b,3));
var cc= (Math.pow(c,3));
var dd= (Math.pow(d,3));
var ee= (Math.pow(e,3));
var ff= (Math.pow(f,3));
var gg= (Math.pow(g,3));
var hh= (Math.pow(h,3));
var ii= (Math.pow(i,3));
var jj= (Math.pow(j,3));
var kk= (Math.pow(k,3));
var ll= (Math.pow(l,3));
var mm= (Math.pow(m,3));
var nn= (Math.pow(n,3));
var oo= (Math.pow(o,3));
var q = (aa+bb+cc+dd+ee+ff+gg+hh+ii+jj+kk+ll+mm+nn+oo);
var y = (aa+bb+cc+dd+ee+ff+gg+hh+ii+jj+kk+ll+mm+nn+oo);
form.DegD.value = y
var p = 0;
p = (Math.pow(q,1/3)) ;
z = (Math.round(p));
form.DegC.value = z

}

</script>

.::Html::.



<form style="text-align:center">
<label>01 <input name=DegF type=text value=0 size=30 maxlength=30 /> </label><br/>
<label>02 <input name=DegF2 type=text value=0 size=30 maxlength=30 /> </label><br/>
<label>03 <input name=DegF3 type=text value=0 size=30 maxlength=30 /> </label><br/>
<label>04 <input name=DegF4 type=text value=0 size=30 maxlength=30 /> </label><br/>
<label>05 <input name=DegF5 type=text value=0 size=30 maxlength=30 /> </label><br/>
<label>06 <input name=DegF6 type=text value=0 size=30 maxlength=30 /> </label><br/>
<label>07 <input name=DegF7 type=text value="0"size=30 maxlength=30 /> </label><br/>
<label>08 <input name=DegF8 type=text value="0"size=30 maxlength=30 /> </label><br/>
<label>09 <input name=DegF9 type=text value="0"size=30 maxlength=30 /> </label><br/>
<label>10 <input name=DegF10 type=text value="0"size=30 maxlength=30 /> </label><br/>
<label>11 <input name=DegF11 type=text value="0"size=30 maxlength=30 /> </label><br/>
<label>12 <input name=DegF12 type=text value="0"size=30 maxlength=30 /> </label><br/>
<label>13 <input name=DegF13 type=text value="0"size=30 maxlength=30 /> </label><br/>
<label>14 <input name=DegF14 type=text value="0"size=30 maxlength=30 /> </label><br/>
<label>15 <input name=DegF15 type=text value="0"size=30 maxlength=30 /></label>
<p><input type=button onclick=temp(this.form) value=Calculate name="calc"/>
<label><input type=reset name=Reset id=Reset value=Clear /></label></p>
<blockquote><p>Total Exp&nbsp;&nbsp; <label><input name=DegD type=text size=40 readonly="readonly" /></label></p>
<p>Total Level <label><input name=DegC type=text size=40 readonly=readonly /></label></p></blockquote>
</form>

Here is the website (Example) :: http://xcyber.netii.net/

.::The problem::.

I want to add +1 if one field is filled or add +2 if two fields are filled or etc....
at Total Exp txt field.
I dont know how to code that part.
Your help will be most appreciated!
Thanks for reading...

Darkmirror
10-30-2009, 07:01 PM
Please i am still waiting for the reply...@_@