SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strings in a function

    How do I deal with strings?

    Code:
    function fn1(hh3,hm3,hs3){
         HMS3 = hh3 & "h" & hm3 & "m" & hs3 & "s";
         return HMS3;
    }
    
    function HMS(){
         hh30 = Number(window.document.myform.hh3.value);
         hm30 = Number(window.document.myform.hm3.value);
         hs30 = Number(window.document.myform.hs3.value);
         str = fn1(hh30,hm30,hs30);
         window.document.myform.dmsd3.value = str;
    }

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,701
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Philosophaie View Post
    How do I deal with strings?
    What do you mean?

    Normally you concatenate strings using the + operator. See string operators
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •