SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast Red Blaze's Avatar
    Join Date
    Feb 2006
    Location
    Texas
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with split and math functions

    Code:
    function finalSize(){
    var size = document.getElementById('size').value;
    var margin = document.getElementById('margins').value;
    var mirrors = document.getElemntById('mirrorsRadio').value;
    
    var size_array = size.split('x');
    var h = size_array[0];
    var w = size_array[1];
    
    var finalH = '';
    var finalW = '';
    
      if(margin > 1){
      finalH =  h * margin;
      finalW = w * margin;
      document.getElementById('finalSize').value = finalH+'x'+finalW;
      }else{
      newH = h * margin;
      newF = w * margin;
      finalH = newH + h;
      finalW = newW + w;
      document.getElementById('finalSize').value = finalH+'x'+finalW;
      }
    
    }
    I see it's ok, but it gives me this error:
    Object doesn't support this property or method.
    I don't know what I'm doing wrong. All I know is PHP, but from what little I learned on Javascript, my brain is telling me I'm right, but my experience is telling me I'm wrong. XD

  2. #2
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Red Blaze
    I see it's ok, but it gives me this error:
    It also tells you on which line the problem was.
    Last edited by stereofrog; Nov 7, 2006 at 12:48.


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
  •