How to call a javascript in plone site
I have a html file which is under navigation portlet. I want to call a
javascript from one html file which is in the navigation portlet. I put
the javascript file under custom and registered the javascript in
portal_javascript Registry. But i still can't able to call the javascript.
this is html page :
<script language="Javascript" type="text/javascript"
src="jquery-1.9.1.mins.js">
</script>
<script language="Javascript" type="text/javascript"
src="calculatemyval.js"></script>
<form name="addition">
<tbody><tr>
<td>Value 1: <br>
</td>
<td>
<input size="5" name="v1" type="text">
in kg <br>
</td>
</tr>
<tr>
<td>Value 2 : <br>
</td>
<td>
<input size="5" name="v2" type="text">
in cm <br>
</td>
</tr>
<tr>
<td> <br>
</td>
<td>
<input value="calc" onclick="calcvalue()" name="button"
type="button"><br>
</td>
</tr>
<tr>
<td>Result: <br> </td>
<td><input name="result" size="5" readonly="readonly" type="text">
<br></td>
</tr>
</tbody>
</form>
Here is my script :
calculatemyval.js
<script type="text/javascript">
function calcvalue(){
var h = document.addition.v1.value;
var g = document.addition.v2.value;
var res = 0;
if (h > 0){
h = h / 100.0;
res = g / (h * h);
res = Math.ceil(res * 10) / 10
document.addition.result.value = res;
}
}
</script>
Thanks
No comments:
Post a Comment