SupportArea

BoltWire is a FREE content management system written in PHP.

Its innovative architecture combined with best-in-class forms processing makes it ideal for creating complex, interactive, web applications fast...


PLUGINS

SKINS

LANGUAGES

Calculator

Extensions > Plugins > Calculator

Here's a simple little calculator--just to illustrate how the embed function works. Here's what it looks like:



Here's all you have to do. First copy this text to your page:


<box style='width: 230px'>
<(embed calculator)>
</box>

Now copy the following to code.embed.calculator. This is the code your embed function above will insert into your page. That's all there is to it!

There are plenty of little javascript snippets out there you can instantly insert into your site using this same technique.


<div id=calculator>
<script>
<!>>
function calculate(expr) {
     expr = expr.toUpperCase();
     var filter = 'ABCDFGHIJKLMNOPQRSTUVWXYZ';
     for (i=0; i<filter.length; i++) {
          if (expr.indexOf(filter.charAt(i)) != -1) {
               document.Calc.Input.value = '';
               return;
               }  
          }
     document.Calc.Input.value = eval(document.Calc.Input.value);
     }
//>>>
</script>
<FORM NAME="Calc">
<TABLE BORDER=10><TR><TD>
<INPUT TYPE="text" NAME="Input" style="border: 1; margin: 3px 3px 0px 3px; background-color: #fff; color: #000; text-align: right; width: 158px; padding-left: 10px;">
</TD></TR><TR><TD>
<TABLE BORDER=0><TR><TD>
<INPUT TYPE="button" NAME="one"   VALUE="  1  " OnClick="Calc.Input.value += '1'">
<INPUT TYPE="button" NAME="two"   VALUE="  2  " OnCLick="Calc.Input.value += '2'">
<INPUT TYPE="button" NAME="three" VALUE="  3  " OnClick="Calc.Input.value += '3'">
<INPUT TYPE="button" NAME="plus"  VALUE="  +  " OnClick="Calc.Input.value += ' + '">
</TD></TR>

<TR><TD>
<INPUT TYPE="button" NAME="four"  VALUE="  4  " OnClick="Calc.Input.value += '4'">
<INPUT TYPE="button" NAME="five"  VALUE="  5  " OnCLick="Calc.Input.value += '5'">
<INPUT TYPE="button" NAME="six"   VALUE="  6  " OnClick="Calc.Input.value += '6'">
<INPUT TYPE="button" NAME="minus" VALUE="  -  " OnClick="Calc.Input.value += ' - '">
</TD></TR>

<TR><TD>
<INPUT TYPE="button" NAME="seven" VALUE="  7  " OnClick="Calc.Input.value += '7'">
<INPUT TYPE="button" NAME="eight" VALUE="  8  " OnCLick="Calc.Input.value += '8'">
<INPUT TYPE="button" NAME="nine"  VALUE="  9  " OnClick="Calc.Input.value += '9'">
<INPUT TYPE="button" NAME="times" VALUE="  x  " OnClick="Calc.Input.value += ' * '">
</TD></TR>

<TR><TD>
<INPUT TYPE="button" NAME="clear" VALUE="  .  " OnClick="Calc.Input.value += '.'">
<INPUT TYPE="button" NAME="zero"  VALUE="  0  " OnClick="Calc.Input.value += '0'">
<INPUT TYPE="button" NAME="exp"  VALUE="  E  " OnClick="Calc.Input.value += 'E'">
<INPUT TYPE="button" NAME="div"   VALUE="  /  " OnClick="Calc.Input.value += ' / '">
</TD></TR>

<TR><TD>
<INPUT TYPE="button" NAME="leftp"  VALUE="  (  " OnClick="Calc.Input.value += ' ( '">
<INPUT TYPE="button" NAME="rightp"  VALUE="  )  " OnClick="Calc.Input.value += ' ) '">
<INPUT TYPE="button" NAME="clear" VALUE="  c  " OnClick="Calc.Input.value = ''">
<INPUT TYPE="button" NAME="equal"  VALUE="  =  " OnClick="calculate(Calc.Input.value)">
</TD></TR></TABLE>
</TD></TR></TABLE>
</FORM>
</div>