simple wordpress plugin with some html and javascript

Posted by h_a86 on Stack Overflow See other posts from Stack Overflow or by h_a86
Published on 2012-03-02T08:02:52Z Indexed on 2012/04/06 5:29 UTC
Read the original article Hit count: 149

Filed under:
|

I have an html page which i have to convert to wordpress plugin. my code is simple html and javascript

<html>
<head>
    <title>Calculate</title>
    <script language="javascript">
            function addNumbers()
            {
                    var val1 = parseInt(document.getElementById("value1").value);
                    var val2 = parseInt(document.getElementById("value2").value);
                    var ansD = document.getElementById("answer");
                    ansD.value = val1 + val2;
            }
    </script>

</head>
<body>
   <input type="text" id="value1" name="value1" value="1"/>
   <input type="text" id="value2" name="value2" value="2"/>
   <input type="button" name="Sumbit" value="Click here"               
   onclick="javascript:addNumbers()"/>
   <input type="text" id="answer" name="answer" value=""/>
</body>
</html>

I know basic plugin writing skills such as

<?php
/*
Plugin Name: Coding friends hello world
Plugin URI: http://www.codingfriends.com/
Description: Outputs hello world
Version: 0.1
Author: Genux
Author URI: http://www.codingfriends.com   
License: GPL2
*/

function codingfriends_helloworld()
{
//put you form here and javascript here
}

add_action('get_header', 'codingfriends_helloworld');
?> 

Thanks in advance

© Stack Overflow or respective owner

Related posts about Wordpress

Related posts about wordpress-plugin