|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
discount script
hi all !
I have no idea on Java script but I need to know if this is possible. From my server I get a bill and on that bill I can make discount on the total. if I change the % textfield it should take the total and make the discount on it and substitute the old total with the new one. Can you give me an example on how to do it ? THanks! |
|
#2
|
||||
|
||||
|
Come on mate, throw us a bone.
Show us the code you have so far... |
|
#3
|
|||
|
|||
|
Quote:
I dont have any code yet... I just need to know if what Im asking its possible. With out any redirections.... Thanks! |
|
#4
|
||||
|
||||
|
Yes, it is.
|
|
#5
|
|||
|
|||
|
Quote:
Ok ! thanks ! But as I said I have no idea on javascript. So I will do my best. Code:
<script language="JavaScript">
function discount(percent,total)
{
alert("Discount function");
discount= percent/100;
total= (total -(total*discount));
}
</script>
What I dont know its how to subtitute the old total with the new one. Any help on that is appreciated. |
|
#6
|
|||
|
|||
|
Code:
<script language="JavaScript" type="text/javascript">
function discount(percent,total)
{
var total2=0;
var discount=0;
alert("Función descuento");
discount= (percent/100);
document.write(discount);
total2= (total -(total*discount));
}
</script>
This is my last code... so I need to know how to replace the old total with the new one. Also how do I do to make the percent (parameter of my function) the value of a textefield? I want the function to take the value from that textfield that its the one thats also calling the javascript |
|
#7
|
|||
|
|||
|
Agent47 can you help me here with the code please ? I really need it .
Thanks! |
|
#8
|
||||
|
||||
|
You can't document.write() anything once the page has finished
loading. We need to see your corresponding html code too... |
|
#9
|
|||
|
|||
|
Quote:
Then why you said that what I was looking for was possible ? here is my code its kinda huge PHP Code:
|