close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Adding 2 Decimals

Thread began 10/02/2015 12:56 pm by salaroche | Last modified 10/04/2015 9:15 pm by salaroche | 445 views | 2 replies

salaroche

Adding 2 Decimals

Ray:

You recently helped me with the script included below which gives whole numbers as result. How can I allow for two decimals in the result? I have tried using the number_format() function but couldn't make it work

<script type="text/javascript">
var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {validateOn:["blur"]});
var spryselect5 = new Spry.Widget.ValidationSelect("spryselect5", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur"]});
var spryselect6 = new Spry.Widget.ValidationSelect("spryselect6");
var spryselect7 = new Spry.Widget.ValidationSelect("spryselect7");
var spryselect8 = new Spry.Widget.ValidationSelect("spryselect8");
var spryselect9 = new Spry.Widget.ValidationSelect("spryselect9");


function updateTot(row) {
var rowTot = 0;
var theField = document.getElementById("cw_"+row);
if (theField.selectedIndex != 0) rowTot += parseInt(theField.options[theField.selectedIndex].value);
var theField = document.getElementById("con_"+row);
if (theField.selectedIndex != 0) rowTot += parseInt(theField.options[theField.selectedIndex].value);
var theField = document.getElementById("att_"+row);
if (theField.selectedIndex != 0) rowTot += parseInt(theField.options[theField.selectedIndex].value);
var theField = document.getElementById("attpunct_"+row);
if (theField.selectedIndex != 0) rowTot += parseInt(theField.options[theField.selectedIndex].value);
var theField = document.getElementById("part_"+row);
if (theField.selectedIndex != 0) rowTot += parseInt(theField.options[theField.selectedIndex].value);
var theField = document.getElementById("disc_"+row);
if (theField.selectedIndex != 0) rowTot += parseInt(theField.options[theField.selectedIndex].value);
var theField = document.getElementById("proj_"+row);
if (theField.selectedIndex != 0) rowTot += parseInt(theField.options[theField.selectedIndex].value);
var theField = document.getElementById("exAct_"+row);
if (theField.selectedIndex != 0) rowTot += parseInt(theField.options[theField.selectedIndex].value);

document.getElementById("show_"+row).innerHTML = rowTot;
document.getElementById("total_"+row).value = rowTot;

}
</script>

<td width="16%" align="center" valign="middle" class="td7"><span id="show_<?php echo $RepeatSelectionCounter_1; ?>">0</span>
<input type="hidden" name="total_<?php echo $RepeatSelectionCounter_1; ?>" /></td>

Any suggestions?

Thank you for your attention

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...