simple wordpress plugin with some html and javascript
- by h_a86
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