Set x and y coordinates dynamically calling JavaScript functions

Discussion in 'JavaScript' started by cre8ive, Dec 17, 2007.

  1. #1
    I can set an object’s x and y coordinates using CSS like the following:
    
    <div class="prx" style="left: 0%; top: 10%; height: 60px; width: 970px; z-index: 2;"><img alt="" src="images/strip.jpg"></div>
    
    Code (markup):
    ’left: 0%; top: 10%;’ sets x and y coordinates. However, I’d like to set these coordinates dynamically calling JavaScript functions like:
    
    <div class="prx" style="left: setX(param1); top: setY(param1); height: 60px; width: 970px; z-index: 2;"><img alt="" src="images/strip.jpg"></div>
    
    Code (markup):
    q1. Can I do something like this?

    q2. If so, exactly how do I do this?
     
    cre8ive, Dec 17, 2007 IP
  2. temp2

    temp2 Well-Known Member

    Messages:
    1,231
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    2
    #2
    q1. No, you can't.
    q1.
     
    temp2, Dec 18, 2007 IP
  3. cre8ive

    cre8ive Peon

    Messages:
    295
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I was looking at this yesterday, and I found something like the following ...

    
    style { width: expression(...) }
    
    Code (markup):
    Can this be used?

    It seems to work in IE, but I couldn't get it to work in Firefox ...
     
    cre8ive, Dec 18, 2007 IP