SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Stockholm, Sweden
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Typecasting in HTML?

    Actually, what i want is this:
    To use the left value of a layer you use layerName.style.left right? The problem is that its holding a string value (eg. 230px), but i want the value in integer (so i can multiply with it). Ive tried typecasting it in Vbscript, CInt(layerName.style.top), but it doesnt work. Does anyone have any suggestions?

    thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Stockholm, Sweden
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind, luckily i found the answer. I just had to use the Vbscript function Replace(), remove the "px" string and then CInt() worked just fine.

    Is there such a function in Javascript?

  3. #3
    SitePoint Enthusiast RogueJedi's Avatar
    Join Date
    Oct 2001
    Location
    Texas
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In JavaScript/JScript you would use the parseInt() function.
    Rob Nolan
    Do or do not, there is no try.


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
  •