Saturday 15 March 2014

How can I use html tag in this javascript? -



How can I use html tag in this javascript? -

this question has reply here:

changing way javascript alert() or prompt() looks 3 answers

how can utilize html tag in javascript?

first of all, why <br> doesn't work in prompt. secondly, why can't utilize tags code (poundone.pound) create font larger using css or html code such <h1>, <h2>, <h3>... or <div style="......">?

<html> <head> <script type="text/javascript"> function poundtokgconvertor( pound ){ this.pound = pound; this.convertordon = convertor; } function convertor(){ var convert = this.pound * 0.453592; homecoming convert; } var poundone = new poundtokgconvertor(prompt ("convert pound kilogram!<br> please insert number of pound!")); </script> </head> <body> <script type="text/javascript"> document.write(poundone.pound + " pound = " + poundone.convertordon() + " <b>kilogram</b>"); </script> </body> </html>

you can't utilize html in prompt/alert dialogs. can utilize new line characters:

prompt ("convert pound kilogram!\n please insert number of pound!");

javascript html css oop

No comments:

Post a Comment