www.webdeveloper.com
Results 1 to 3 of 3

Thread: JS Help for function

Threaded View

  1. #1
    Join Date
    May 2009
    Posts
    5

    JS Help for function

    Maybe someone can help me!? I am not very experienced in javascript.
    The problem: I have two images which I us for different switching displays, the small one is s_filename.jpg and the large one is x_s_filename.jpg

    The script below is grabbing the filename prefix, but only the first letter, how can I manage it to get the first 3 or 2 letters like x_s

    function sizeName(imgsize){
    var size_name

    switch (imgsize)
    {
    case 1 :
    size_name = 'x_s';
    break;
    default : // 0
    size_name = 's';
    }
    return size_name;
    }
    I appreciate any help.
    Last edited by omar1000; 05-03-2009 at 07:43 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles