SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    May 2008
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hi can someone convert this for me.. thanks for the help.

    i got this vbscript from my friend unfortunately were both javascript dummies,

    when we tried using this script in firefox, unfortunately, its not working, so i figured prabobly with regular javascript it should work.

    any help will be appreciated. thanx.

    heres the code:

    Code:
    <script language= VBscript>
    
    sub mnuNextCall_OnClick
    with Menu
      .txtCallCntr.Value = Int(.txtCallCntr.Value) + 1
    end with
    end sub
    
    </script>
    
    -------
    
    <input type='button' name='mnuNextcall' value='Start Next Call' style='font-family: verdana; font-size: 10px;'>

  2. #2
    SitePoint Evangelist ferrari_chris's Avatar
    Join Date
    Mar 2008
    Location
    NP, New Zealand
    Posts
    576
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 2ji8888 View Post
    i got this vbscript from my friend unfortunately were both javascript dummies,

    when we tried using this script in firefox, unfortunately, its not working, so i figured prabobly with regular javascript it should work.

    any help will be appreciated. thanx.

    heres the code:

    Code:
    <script language= VBscript>
    
    sub mnuNextCall_OnClick
    with Menu
      .txtCallCntr.Value = Int(.txtCallCntr.Value) + 1
    end with
    end sub
    
    </script>
    
    -------
    
    <input type='button' name='mnuNextcall' value='Start Next Call' style='font-family: verdana; font-size: 10px;'>
    Try something like this:

    Code:
    <script language="javascript">
    
    function mnuNextCallIncrease() {
     Menu.txtCallCntr.value = Menu.txtCallCntr.value + 1;
    }
    
    -------
    
    <input type='button' name='mnuNextcall' value='Start Next Call' style='font-family: verdana; font-size: 10px;' onclick='mnuNextCallIncrease()'>

    But without the rest of the page it's a little difficult to be 100% certain that'll work for you.
    Last edited by ferrari_chris; Jul 17, 2008 at 01:50.

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    here's how to do it properly.

    Code css:
    #mnuNextcall {
        font-family: verdana; font-size: 10px;
    }

    Code html4strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
        <title>Test</title>
        <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body>
    <form id="menu" action="process.php">
        <p><input type="text" name="txtCallCntr" value="0" disabled="disabled"></p>
        <p><input type="button" name="mnuNextcall" value="Start Next Call"></p>
    </form>
    <script src="js/script.js"></script>
    </body>
    </html>

    Code javascript:
    var menu = document.getElementById('menu');
    menu.elements['mnuNextcall'].onclick = function () {
    	this.form.elements['txtCallCntr'].value++;
    }
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Member
    Join Date
    May 2008
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im sorry guys but none of your suggestions worked. i tried both of em but still no luck.

    any other ideas?

    thanks.

  5. #5
    SitePoint Evangelist ferrari_chris's Avatar
    Join Date
    Mar 2008
    Location
    NP, New Zealand
    Posts
    576
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 2ji8888 View Post
    im sorry guys but none of your suggestions worked. i tried both of em but still no luck.

    any other ideas?

    thanks.
    Perhaps you could post up your whole page so we can tweak your code to work, rather than incorrectly trying to write a whole new page for you?

  6. #6
    SitePoint Member
    Join Date
    May 2008
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    right.. thanks...

    here it is..


    Code:
    <html>
    <head><title>My Notes Maker</title>
    <STYLE type="text/css">
    body {background-color: 000000}
    
    
    input    {
          font-family:Verdana, sans-serif;
          font-size:9px;
          font-style: normal;
          line-height: normal;
          color: #333333;
           }
    
    p      {
        font-family:Verdana, sans-serif;
        font-size:10px;
        font-style: normal;
        line-height: normal;
        color: CC9933;
        }
    
    input.time     {
              font-family:Verdana, sans-serif;
            }
    
    td.time         {
              font-family:Verdana, sans-serif;
              font-weight: bold;
              font-size:15px;
    
    
              background-color: 004000;
              color: red;
            }
    
    a:link {text-decoration: none; text-transform: none; }
    a:visited {color: CC9933; text-decoration: none; text-transform: none; }
    
    </STYLE>
    
    <style type="text/css">
             .default{
                width: 310px;
                padding: 3px;
                text-align:left;
                font:bold 10pt sans-serif;
                background-color:F2F2F2;
                font-size:11px;
                border:1px solid #000000;
             }
             .calcAvgInput{
                float:right;
                background-color:#FFFFFF;
                border:1px solid #7F9DB9;
                font:normal 10pt sans-serif;
             }
          </style>
    
    
    
    
    <script type="text/javascript">
    
    
    function StopWatch (showTime) {
      this.id = StopWatch.watches.length;
      StopWatch.watches[this.id] = this;
      this.showTime = typeof showTime == 'function' ? showTime : function
    () {};
      this.reset();
    }
    StopWatch.prototype.reset = function () {
      this.time = 0;
      this.components = {};
      this.computeComponents();
      this.showTime(this.components);
    }
    StopWatch.prototype.start = function () {
      this.tid = setTimeout('StopWatch.watches[' + this.id + '].run()',
    1000);
    }
    StopWatch.prototype.stop = function () {
      clearTimeout(this.tid);
    }
    StopWatch.prototype.run = function () {
      this.tid = setTimeout('StopWatch.watches[' + this.id + '].run()',
    1000);
      this.time++;
      this.computeComponents();
      this.showTime(this.components);
    }
    StopWatch.prototype.computeComponents = function () {
      var hours = Math.floor(this.time / StopWatch.secondsPerHour);
      var remainingTime = this.time - hours * StopWatch.secondsPerHour;
      var minutes = Math.floor(remainingTime / StopWatch.secondsPerMinute);
      var seconds = remainingTime - minutes * StopWatch.secondsPerMinute;
      var formattedTime = '';
      formattedTime += hours + ':';
      formattedTime += minutes < 10 ? '0' + minutes + ':' : minutes + ':';
      formattedTime += seconds < 10 ? '0' + seconds : seconds;
      this.components.time = this.time;
      this.components.hours = hours;
      this.components.minutes = minutes;
      this.components.seconds = seconds;
      this.components.formattedTime = formattedTime;
    }
    StopWatch.secondsPerMinute = 60;
    StopWatch.secondsPerHour = StopWatch.secondsPerMinute * 60;
    StopWatch.watches = new Array();
    </script>
    
    <script type="text/javascript">
    var stopWatch2;
    function showTimeTableWatch (components) {
      if (document.all)
        document.all.timeCell.innerText = components.formattedTime;
      else if (document.getElementById)
        document.getElementById('timeCell').firstChild.nodeValue =
    components.formattedTime;
    }
    </script>
    
    
    <script type="text/javascript">
    stopWatch = new StopWatch(showTimeFormWatch);
    </script>
    
    <script language= VBscript>
    
    sub mnuNextCall_OnClick
    with Menu
      .txtCallCntr.Value = Int(.txtCallCntr.Value) + 1
    end with
    end sub
    
    </script>
    
    </head>
    
    
    <body>
           <div align="left">
            <form name="notepad">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-collapse:
    
    collapse">
    
                <tr>
                <td>
                <textarea name="commentbox" rows="14" cols="38" wrap="">
    issue: Unable to connect to the Internet
    tel: 
    caller: 
    p.email: 
    os: XP 
    modem: 
    router: none
    
    t/s
    
    
                </textarea>
                </tr>
                </td>
     
    
    
            <tr>
            <td>
            <input type="reset" name="reset3" value="RESET" style="font-family: Verdana font-size: 9.0pt"
    
    >
            </td>
            </tr>
            </form>
    
     
                <form name="notepad2">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-collapse:
    
    collapse">
     
                <tr>
                <td>
                    <textarea name="commentbox" rows="5" cols="38" wrap="">
    
                </textarea>
                </tr>
                     </td>
    
                <tr>
                <td>
                <input type="reset" name="reset4" value="RESET" style="font-family: Verdana font-size:
    
    9.0pt" >
                </td>
                </tr>
                </form>
    
    <tr>
    <td>
    
    
    <br>
    
    <!()()()()()()()()()()()()()()()----------------AHT BOX-----------------------()()()()()()()()()()()()()()()()>
    
    <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
    <td>
    <tr>
      <div class="default" style="background-color:#D9EDDD;">
        <b>Daily Average Handle Time </b>
          <div class="default">
             <input type="text" name="value" id="valueID" value="" class="calcAvgInput" size='5'
    
    'highlight' /> Last Call :
          </div>
          <div class="default">
             <input type="text" name="divisor" id="divisorID" value="0" class="calcAvgInput"
    
    style="background-color:#D9EDDD;font:bold 10pt sans-serif;" size='1' maxlength='2' readonly />
    
    Number's of call :
          </div>
          <div class="default">
             <input type="text" name="total" id="totalID" value="0" class="calcAvgInput"
    
    style="background-color:#D9EDDD;font:bold 10pt sans-serif;" size='6' maxlength='2' readonly /> Total
    
    Handle Time :
          </div>
          <div class="default">
             <input type="text" name="average" id="averageID" value="0" class="calcAvgInput"
    
    style="background-color:#D9EDDD;font:bold 10pt sans-serif;" maxlength='2' readonly /> AHT :
          </div>
        <div class="default">
             <input type="button" value="Calculate Average" class="calcAvgInput" onclick="calcAverage();"
    
    />
          </div>
    <script type="text/javascript">
             function calcAverage(){
                if(isNaN(parseFloat(objAmount.value))){
                   alert("Enter only numbers and try again.");
                } else {
                   objDivisor.value = parseFloat(objDivisor.value) + 1;
                   objTotal.value = parseFloat(objTotal.value) + parseFloat(objAmount.value);
                   objAverage.value = (objTotal.value / objDivisor.value);
                }
             }
      
             var objTotal = document.getElementById("totalID");
             var objAmount = document.getElementById("valueID");
             var objAverage = document.getElementById("averageID");
             var objDivisor = document.getElementById("divisorID");
          </script>
    
    </div>
    
    </td>
    </tr>
    </table>
    
    <br>
    
    <!()()()()()()()()()()()()()()()----------------COUNTER CLOCK-----------------------()()()()()()()()()()()()()()()()>
    
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
        
    <td id="timeCell" class="time" align="center"
    valign="middle">clock </td>
    </tr>
    
    </tr>
    
    <tr>
    <td color="white">
    <input type="button"
           value="start"
           onclick="stopWatch2.start();"
    />
    <input type="button"
           value="stop"
           onclick="stopWatch2.stop();"
    />
    <input type="button"
           value="reset"
           onclick="stopWatch2.reset();"
    />
    </td>
    </tr>
    
    </font>
    </tr></td>
    </table>
    
    
    <script type="text/javascript">
    stopWatch2 = new StopWatch(showTimeTableWatch);
    </script>
    
    <br>
    
    <!()()()()()()()()()()()()()()()----------------COUNTER WITH VBSCRIPT-----------------------()()()()()()()()()()()()()()()()>
    
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
    <tr><td>
    
    <form name="menu">
    
    <input type='button' name='mnuNextcall' value='Start Next Call' style='font-family: verdana; font-size: 10px;'>
    
    
    <div align='left' font-family: verdana; background-color : F2F2F2; font-size: 11px; border:1px solid black;><font face="Verdana" size="1" color="RED">Calls Handled : </font><input type='text' name='txtCallCntr' value='0' size='1' maxlength='2' readonly></div>
    </div>
    
    </form>
    </font>
    
    
    </table>
    </p>
    </table>
    </body>
    </html>

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Change the name attribute on the form to an id element instead.
    You do not use names on forms, only on the elements inside forms.

    Code html4strict:
    <form id="menu">
       ...
    </form>

    Place the javascript code at the end of the body. You shouldn't place your code in the head because that slows down the loading of the page, and requires extra troublesome hoops to be jumped through to access page elements.

    Here is the javascript code. Place it at the bottom of the body.

    Code javascript:
    var menu = document.getElementById('menu');
    menu.elements['mnuNextcall'].onclick = function () {
        this.form.elements['txtCallCntr'].value++;
    }

    Read the following best practices for speeding up your web site.
    http://developer.yahoo.com/performance/rules.html
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #8
    SitePoint Member
    Join Date
    May 2008
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    paul, its working now... thanks so much... appreciate the help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •