haolan Posted August 19, 2007 Share Posted August 19, 2007 Hi.. Is there any way to change the font family in a textarea with a <select> box? It has to change immediately while selecting a new font in the select box.. :-Haolan Quote Link to comment Share on other sites More sharing options...
php_tom Posted August 19, 2007 Share Posted August 19, 2007 Try this: <html> <head> <script type='text/javascript'> function changeFont() { document.getElementById('txt').style.fontFamily="Sans"; } </script> </head> <body> <textarea onclick='changeFont()' id='txt'>Here is some text whose font will be changed if you click here.</textarea> </body> </html> It shouldn't be too hard to modify it to work with a select dropdown. Hope that helps. Quote Link to comment 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.