I'm trying to develope a Javascript fuction that will show the current funds raised. I'm needing to be able to specify a Start Dollar Amount ($0), Goal Dollar Amount ($XXX,XXX,XXX), and a Current Dollar Amount ($XX,XXX). I would like to have this show up as numerical amount and then also a percentage. I know I can predefine the amounts in the javascript itself but is there a way to have the javascript read a .txt file that hase the amounts in it? I have a working script that already does the above but not the .txt file portion. I'm hoping someone can help me. The site I'm working on is completely coded in ASP if that helps any.

        <title>Demo Counter</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            (function($) {
                $.fn.countTo = function(options) {
                    // merge the default plugin settings with the custom options
                    options = $.extend({}, $.fn.countTo.defaults, options || {});

                    // how many times to update the value, and how much to increment the value on each update
                    var loops = Math.ceil(options.speed / options.refreshInterval),
                        increment = (options.Current - options.Start) / loops;

                    return $(this).each(function() {
                        var _this = this,
                            loopCount = 0,
                            value = options.Start,
                            interval = setInterval(updateTimer, options.refreshInterval);

                        function updateTimer() {
                            value += increment;

                            if (typeof(options.onUpdate) == 'function') {
                                options.onUpdate.call(_this, value);

                            if (loopCount >= loops) {
                                value = options.to;

                                if (typeof(options.onComplete) == 'function') {
                                    options.onComplete.call(_this, value);

                $.fn.DifferenceTo = function(option2) {


                $.fn.countTo.defaults = {
                    Start: 0,  // the number the element should start at
                    End: 100,  // the number the element should end at
                    Current: 50, // the current number
                    speed: 1000,  // how long it should take to count between the target numbers
                    refreshInterval: 100,  // how often the element should be updated
                    decimals: 0,  // the number of decimal places to show
                    onUpdate: null,  // callback method for every time the element is updated,
                    onComplete: null,  // callback method for when the element finishes updating

        <link type="text/css" rel="stylesheet" media="screen" href="style.css" />
        <script type="text/javascript"><!--
            jQuery(function($) {
                    Start: 0,
                    End: 2500,
                    Current: 1250,
                    speed: 5000,
                    refreshInterval: 50,
                    onComplete: function(value) {
        <span class="timer"></span>
        <p>We are $<span class="deficit"></span> from our goal.  Please help us reach it.</p>

You can have a look at this snippet from Microsoft website to get an idea of achieving what you want. Check it out

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.