Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

JavaScript kod u HTML kod

[es] :: Javascript i AJAX :: JavaScript kod u HTML kod

[ Pregleda: 1363 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

jecaCoje
programer
Šid

Član broj: 256934
Poruke: 5
*.adsl-a-3.sezampro.rs.



Profil

icon JavaScript kod u HTML kod09.04.2010. u 11:50 - pre 171 meseci
Pozdrav,

imam problem sa sledećim kodom:

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
      <script type="text/javascript">

            double b4 = 0;

            if (request.getParameter("in") != null) {

                b4 = Double.parseDouble(request.getParameter("in"));
            } else {
                b4 = 0;
            }

            double c4 = b4 * 14;
            double e3 = 0, e4 = 12000, e5 = 16000, e6 = 22000, e7 = 26000, e8 = 32000, e9 = 40000, e10 = 60000, e11 = 100000;
            double f3 = 0, f4 = 0.18, f5 = 0.24, f6 = 0.26, f7 = 0.32, f8 = 0.36, f9 = 0.38, f10 = 0.40, f11 = 0.45, f13 = 0.159;
            double g3 = 0, g4 = f4 - f3, g5 = f5 - f4, g6 = f6 - f5, g7 = f7 - f6, g8 = f8 - f7, g9 = f9 - f8, g10 = f10 - f9, g11 = f11 - f10;

            double b5 = b4 * (1 - f13);
            double c5 = b5 * 14;

            double c6;
            if (c5 > e10) {
                c6 = (c5 - e10) * g10;
            } else if (c5 > e9) {
                c6 = (c5 - e9) * g9;
            } else if (c5 > e8) {
                c6 = (c5 - e8) * g8;
            } else if (c5 > e7) {
                c6 = (c5 - e7) * g7;
            } else if (c5 > e6) {
                c6 = (c5 - e6) * g6;
            } else if (c5 > e5) {
                c6 = (c5 - e5) * g5;
            } else if (c5 > e4) {
                c6 = (c5 - e4) * g4 / 100;
            } else {
                c6 = 0;
            }
            c6 = c6 * 100;
            c6 = Math.round(c6);

            double b6 = c6 / 14;
            b6 = Math.round(b6);

            double c7 = c6 - c5;
            c7 = Math.abs(c7);
            c7 = Math.round(c7);


            double b7 = c7 / 14;
            b7 = Math.abs(b7);
            b7 = Math.round(b7);


            double b9 = 0;
            if (b4 != 0) {
                b9 = 1 - (b7 / b4);
                b9 = b9 * 100;
                b9 = Math.round(b9);
            }

            double b10 = 0;
            if (c4 != 0) {
                b10 = c6 / c4;
                b10 = b10 * 100;
                b10 = Math.round(b10);
            }

            double b11 = 0;
            if (b4 != 0) {
                b11 = f13;
                b11 = b11 * 100;
                b11 = Math.round(b11);
            }</script>
  <h3>Input value:</h3>
        <form action='nesto.jsp' >
        <input type='text' name='in' value="" style="background: gainsboro" /> </form>       
        <br><br>
       <table border="1" bgcolor="wheat">
            <thead>
                <tr>
                    <th width=104px colspan="3" style=" border: black thick"><h3>Title</h3></th>
                </tr>
                <tr>
                    <th width=104px></th>
                    <th width=104px>Text 1</th>
                    <th width=104px>Text 2</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width=104px>Text 3</td>
                    <td width=104px bgcolor="gainsboro" align="right"> <script> out.print(b4) </script> €</td>
                    <td width=104px align="right"><script> out.print(c4) </script> €</td>
                </tr>
                <tr>
                    <td width=104px>Text 4</td>
                    <td width=104px align="right"><script> out.print(b5) </script> €</td>
                    <td width=104px align="right"><script> out.print(c5) </script> €</td>
                </tr>
                <tr>
                    <td width=104px>Text 5</td>
                    <td width=104px align="right"><script> out.print(b6) </script> €</td>
                    <td width=104px align="right"><script> out.print(c6) </script> €</td>
                </tr>
                <tr>
                    <td width=104px>Text 6</td>
                    <td width=104px align="right"><script> out.print(b7) </script> €</td>
                    <td width=104px align="right"><script> out.print(c7) </script> €</td>
                </tr>
            </tbody>
        </table>
        
        
        <br>
        <table border="1" bgcolor="wheat">
            <tbody>
                <tr>
                    <td width="160px" >Text 7</td>
                    <td width="160px" align="right"> <script> out.print(b9) </script>%</td>
                    
                </tr>
                <tr>
                    <td width="160px">Text 8</td>
                    <td width="160px" align="right"><script> out.print(b10) </script> %</td>
                    
                </tr>
                <tr>
                    <td width="160px">Text 9</td>
                    <td width="160px" align="right"><script> out.print(b11) </script> %</td>
                    
                </tr>
            </tbody>
        </table>
        <br>
        
        <table border="1" bgcolor="wheat">
            
            <tbody>
                <tr style=" border-width: 2">
                    <td width="60">Note 1:</td>
                    <td width="260"><input type="text" value="" size="40"></td>
                </tr>
                <tr>
                    <td width="60">Note 2:</td>
                    <td width="260"><input type="text" value="" size="40"></td>
                </tr>
            </tbody>
        </table>
        
        
  </body>
</html>


Naime, ne štampa rezultate u tabeli (npr. <script>out.print(b11) </script>).
Da li neko zna gde grešim?
 
Odgovor na temu

jecaCoje
programer
Šid

Član broj: 256934
Poruke: 5
*.adsl-a-3.sezampro.rs.



Profil

icon Re: JavaScript kod u HTML kod09.04.2010. u 11:54 - pre 171 meseci
Izvinjavam se zbog greške...forma ne upućuje na nesto.jsp tj. upucuje na trenutnu stranicu.
 
Odgovor na temu

[es] :: Javascript i AJAX :: JavaScript kod u HTML kod

[ Pregleda: 1363 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.