Results 1 to 2 of 2
  1. #1
    sally mally is offline Member
    Join Date
    Nov 2013
    Rep Power

    Default how to create a javascript

    please help me.
    i dont know how to create a javascript on my coding to calcutate the redeem points minus the total price
    when click on the radio button it will minus the total of price

    here my codes:


    <%@ page import="" %>
    <%@ page import="order.OrderDetails" %>
    <%@ page import="java.util.Vector" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">

    <%@ page import="" %>
    <%@ page import="" %>

    <%@ page import="order.OrderDetails" %>
    <%@ page import="java.util.Vector" %>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>payment type</title>
    <script type="text/javascript" src="js/form.js"></script>
    <style type="text/css">
    body {
    background-color: #FFF;
    .Tablebalance {
    background-color: #6CC;
    color: #000;
    font-style: normal;
    font-weight: bold;
    <script type="text/javascript">
    function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;

    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}


    <body onload="MM_preloadImages('pay2.png','cancel2.png', 'cash.jpg','home.jpg','confirm2.png','points.png', 'member.jpg','aa2.png')">

    <table width="100%" height="350" border="0">
    <td><p><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','home.jpg',1)" ><img src="s.png" name="home" width="100" height="100" border="1" id="home" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pay','','cash.jpg',1)"> <img src="cash2.png" name="pay" width="100" height="100" border="1" id="pay" /></a><a href="paymenttype.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('a','','aa2.png',1)"><im g src="aa.png" name="a" width="110" height="88" border="0" align="right" id="a" /></a></p>
    <table width="60%" border="0" align="center">


    /* Get membership id to search from the searchmember.jsp and
    parse to int for ease of life */
    int membershipId = Integer.parseInt(request.getParameter("id"));

    /* Encapsulate in a member object - not to violate OO principle */
    Member memberToSearch = new Member();

    /* Get result from database */

    try {
    MemberController memberCtrl = new MemberController();
    memberToSearch = memberCtrl.selectMember(memberToSearch);

    } catch (Exception e) {


    <td width="28%" height="538" align="center" valign="top" bgcolor="#FFFFFF"><fieldset>
    <legend>ORDER SUMMARY</legend>


    OrderDetails dummy1 = new OrderDetails();
    Menu item = new Menu();

    Vector<OrderDetails> dummies = new Vector<OrderDetails>();

    Vector<OrderDetails> orderItems = dummies;
    double subTotal = 0.00d;
    double total = 0.00d;
    double tax = 0.00d;

    for (OrderDetails items:orderItems) {

    <p><input type="text" name="textfield" id="textfield" value=" <%= items.getQuantity()%> <%=items.getOrderItem().getName() %> RM <%= items.getSubTotal() %>" readonly/>
    <input type="hidden" name="id" value="<%= memberToSearch.getMembershipId() %>" />


    subTotal += items.getSubTotal();
    tax = subTotal * 0.1;
    total = subTotal + tax;

    <form id="form1" name="form1" method="post" action="">
    <input type="text" name="textfield4" id="textfield7" value=" RM <%= total %>" onclick="getRedeemPoints" readonly/>

    <td width="66%"><table width="100%" border="1" align="center" class="Tablebalance">
    <tr align="center">
    int id = Integer.parseInt(request.getParameter("id"));
    MemberController memberCtrl = new MemberController();
    Member member = new Member();
    member = memberCtrl.selectMember(member);


    <td><strong>Current Points :</strong></td>
    <td><form id="form3" name="form3" method="post" action="">
    <input type="text" name="textfield6" id="textfield9" value="<%=member.getPoint() %>" />

    <body onload='hideTotal()'>
    <div id="wrap">
    <form action="" id="points" onsubmit="return false;">
    <div class="cont_order">

    <table width="100%" height="381" border="0">
    <tr align="center">
    <td valign="middle" bgcolor="#FFFFFF"><table width="100%" border="1" align="center">
    <tr bgcolor="#CCCCCC">
    <td align="center" valign="middle"><strong>POINTS</strong></td>


    <label class='radiolabel'><input type="radio" name="selectedpoints" value="100 POINTS" onclick="calculateTotal()" />
    100 POINTS (RM2.00)</label>
    <label class='radiolabel'><input type="radio" name="selectedpoints" value="200 POINTS" onclick="calculateTotal()" />
    200 POINTS (RM 4.00)</label>
    <label class='radiolabel'><input type="radio" name="selectedpoints" value="300 POINTS" onclick="calculateTotal()" />
    300 POINTS (RM 6.00)</label>
    <label class='radiolabel'><input type="radio" name="selectedpoints" value="400 POINTS" onclick="calculateTotal()" />
    400 POINTS (RM 8.00)</label>
    <label class='radiolabel'><input type="radio" name="selectedpoints" value="500 POINTS" onclick="calculateTotal()" />
    400 POINTS (RM 8.00)</label>
    <br />

    <map name="Map" id="Map">
    <area shape="poly" coords="102,11" href="#" />

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Tucson, AZ
    Rep Power

    Default Re: how to create a javascript

    These are the Java forums. Java and JavaScript are completely different animals.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Replies: 3
    Last Post: 02-11-2013, 08:57 PM
  2. Replies: 10
    Last Post: 09-03-2012, 09:13 PM
  3. Replies: 0
    Last Post: 05-09-2011, 11:02 AM
  4. Problem--How to create dynamic tree structure in jsp using javascript
    By natu in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-11-2010, 09:11 AM
  5. create Instance of class in Javascript
    By TDMaster in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-09-2009, 05:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts