This is the first my post in 2018. The main goal of this post is to check how javascript code embedded into WP post works. The javascript code which is used in this post may be downloaded from here. It is pure javascript implementation without jQuery or other libraries. The purpose of the code is to convert Roman numbers into decimal ones and back. I hope you know at least a bit about Roman numerals, if not read the following Wikipedia article. Now time to verify how my convertor works, enter some decimal number into text box, for example your DOB, and click on “Convert” button.
Result: |
So javascript added into WP post works without problem. The current post arrangement looks like:
Javascript code <script type="text/javascript"> |
Text |
HTML Form <form> |
Google Ad |
Text |
The JavaScript code is located in the beginning of the post and it is totally invisible. The current JavaScript code is accessible only by current post, if you want that JavaScript functions are used from different pages of your blog place the code inside of header.php or footer.php files.
Now a little about Roman numeral symbol encoding. To represent roman numeral I am using ASCII symbols: I, V, X, L, C, D, and M. However some Roman numbers have its own representation in Unicode:
Number: | Ⅰ | Ⅱ | Ⅲ | Ⅳ | Ⅴ | Ⅵ | Ⅶ | Ⅷ | Ⅸ | Ⅹ | Ⅺ | Ⅻ | Ⅼ | Ⅽ | Ⅾ | Ⅿ |
Code: | x2160 | x2161 | x2162 | x2163 | x2164 | x2165 | x2166 | x2167 | x2168 | x2169 | x216a | x216b | x216c | x216d | x216e | x216f |
At the end of the article I put the link to the source code of Roman-Decimal convertor written in C++.