locked
change css attributes RRS feed

  • Question

  • hi everybody !

    I want to rotate a square when I click in a button .. but this code doesn't work ! :(

    document.getElementById("object").style.backgroundColor = "blue";
    
    document.getElementById("object").style.msTransform = rotate(40);

    this message show up for me:

    "0x800a1391 - JavaScript runtime error: 'rotate' is undefined"

    thx all ! ^^

    Monday, May 7, 2012 9:03 PM

Answers

  • Try putting rotate(40) in quotes like this:

    document.getElementById("object").style.msTransform = 'rotate(40)';


    • Edited by jrboddie Monday, May 7, 2012 11:40 PM
    • Proposed as answer by Pan Chan Tuesday, May 8, 2012 6:49 AM
    • Marked as answer by xazin Tuesday, May 8, 2012 6:00 PM
    Monday, May 7, 2012 9:50 PM

All replies

  • Try putting rotate(40) in quotes like this:

    document.getElementById("object").style.msTransform = 'rotate(40)';


    • Edited by jrboddie Monday, May 7, 2012 11:40 PM
    • Proposed as answer by Pan Chan Tuesday, May 8, 2012 6:49 AM
    • Marked as answer by xazin Tuesday, May 8, 2012 6:00 PM
    Monday, May 7, 2012 9:50 PM
  • Hi,

    jrboddie has pointed out the correct direction. Please also add deg after 40 to see whether it works fine:

    document.getElementById("object").style.msTransform = 'rotate(40deg)';

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework


    Tuesday, May 8, 2012 7:00 AM
    Moderator
  • lol ...

    thx all !! :D :P

    Tuesday, May 8, 2012 6:01 PM