bunnyali2013 Posted November 3, 2012 Share Posted November 3, 2012 (edited) I want that when the user click on a button, the text align to the center.. This function of document.execCommand is supported to all browsers, but do not know if the syntax is correct. Here the function below: function centeralign() { lol.document.execCommand('formatDoc', false, 'justifycenter'); }; Not sure what is wrong... Other document.execcomand functions are working well, except this one...alignment... Edited November 3, 2012 by bunnyali2013 Quote Link to comment https://forums.phpfreaks.com/topic/270253-text-align-not-working-javascriptpt/ Share on other sites More sharing options...
hell_yeah Posted November 3, 2012 Share Posted November 3, 2012 (edited) Hi, I guess it should be this way: function centeralign() { lol.document.execCommand('justifycenter', false, null); }; Edited November 3, 2012 by hell_yeah Quote Link to comment https://forums.phpfreaks.com/topic/270253-text-align-not-working-javascriptpt/#findComment-1389960 Share on other sites More sharing options...
bunnyali2013 Posted November 3, 2012 Author Share Posted November 3, 2012 thank its working Quote Link to comment https://forums.phpfreaks.com/topic/270253-text-align-not-working-javascriptpt/#findComment-1389966 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.