PDA

View Full Version : On propertychange issues with text value



alexistkd
Feb 17th, 2011, 05:59 PM
<td width="150" height="100"><input type="text" name="getAmount" style="width:300px; height:80; text-align: left;" class="last_inp" value="" onpropertychange="$('advert_1').css('display', 'none'); OnPropChanged ();"></td>
like that i put an alert code so when i insert in machine 1 dollar the value="" changes to 1 so text input shows number i tried to make alert on propertychange i mean: when text value its > = 1 then shows alert telling that value changed to 1 or 2 3 4 but now its show me alert when its 0 and 1 too i only want > = 1 what im doing wrong?

here is javascript:


<script type="text/javascript">
function Init () {
var textarea = document.getElementById ("textarea");
if (textarea.addEventListener) { // Firefox, Opera, Google Chrome and Safari
textarea.addEventListener ('textInput', OnTextInput, false); // Google Chrome and Safari
}
}

// Google Chrome and Safari
function OnTextInput (event) {
alert ("The following text has been entered: " + event.data);
}
// Firefox, Google Chrome, Opera, Safari from version 5
function OnInput (event) {
alert ("The new content: " + event.target.value);
}
// Internet Explorer
function OnPropChanged () {
if (event.propertyName.toLowerCase () == "value>==1") {
alert ("NEW VALUE ON TOTAL FIELD: " + event.srcElement.value);
}
}

</script>

thanks in advance

Kor
Feb 17th, 2011, 09:28 PM
Hm. onpropertychange is a weird event. Proposed by IE, agreed, but with half of the mouth by W3C... I am not sure it is crossbrowser... What not simply onchange?

alexistkd
Feb 17th, 2011, 09:32 PM
yeah but im looking to how make that shows alert only with number >= 1


function pagar(){
var textarea = document.getElementById ("textarea");
if (event.propertyName.toLowerCase () == "value") && if (event.srcElement.value>= "1") {
alert ("new value on total field: " + event.srcElement.value);
}

when i put 0 it say new value on total field: 0 i want only for number >= 1 :(
but no luck

Kor
Feb 17th, 2011, 10:12 PM
the value property returns a string, not a number. Math comparision should be made between the same types of Primitives.

alexistkd
Feb 17th, 2011, 10:17 PM
What do u recommend me to fix that bro thanks for quick replys

Kor
Feb 18th, 2011, 10:14 AM
like that i put an alert code so when i insert in machine 1 dollar the value="" changes to 1 so text input shows number i tried to make alert on propertychange i mean: when text value its > = 1 then shows alert telling that value changed to 1 or 2 3 4 but now its show me alert when its 0 and 1 too i only want > = 1
What machine? Can you make it more clear, please? Who, where, when inserts what? Things like that...

alexistkd
Feb 18th, 2011, 11:47 AM
Ok bro i will explain more easy: I have a field named Total Amount: what means? total amount of money in $ automatically software puts 0 in Total Amount: 0 like that but when u insert a dollar for example $1 that field changes to 1 what i want to do when that field its >=1 shows an alert that say New Field in total amount is: 1.

What it do now the code: Shows me alert even when its 0 i know i put onpropertychange so as software puts 0 automatically it gonna show alert but i need to make limit just >=1 not 0.

Thanks in advance.

Kor
Feb 18th, 2011, 12:29 PM
Still I don't understand where you enter the value 1, 2, 3, etc and where that value is displayed. Where is the input field and where is the total field. Is it the same? If not, which is the relationship

However, is this what you want?


<input type="text" onkeyup="Number(this.value)>=1?alert('new value on total field: '+this.value):null">

alexistkd
Feb 18th, 2011, 12:33 PM
Something like that but have to be onpropertychange cause that field fills automatically as u put money on pay machine the only thing its it automatically puts 0 in that field total amount i want only show alert when its 1 or more like 2 3 10 90 not 0

alexistkd
Feb 18th, 2011, 12:36 PM
As u see on first code html its the text input but value is emptyt why? Cause software changed as money is inserted if u insert 5 dollar it changes to 5 that value

Kor
Feb 18th, 2011, 01:08 PM
I would be grateful if you would try to be less confuse and try to use the precise terms in detailed explanations. And post some HTML code, please, to see what is all about. So far I do not understand what you are talking about. You keep talking about onpropertychange even if I told you that it is not be used as event. What "money"? What "machine"? Which "field"? Which "total amount"? What "software changed as money is inserted"?

A forum is not a SMS like field of abbreviation. Don't be sparing of typing the whole words in extended and complete phrases.

alexistkd
Feb 18th, 2011, 01:25 PM
i can attach site.zip full true:

http://www.mediafire.com/?j4wzi5933baj053

and a picture

http://i51.tinypic.com/2cdbj9c.jpg

Ok more explained if u see attachment site.zip its like a website with a lot javascript i put all folder into payment machine touchscreen so you can pay your accounts cellphone, like cellphone recharge to have minutes to talk. You select provider like Telefonica Movistar then u write your cell number then you insert in a slot the amount u want like 1$ dollar then in Amount field its changes automatically when u insert money if u insert 1dollar it detects 1 if you insert 5 dollar it detect 5 and put it on text field but before insert money the field fills with value 0 until u insert money then it changes automatically thats the real life. But in localhost if you simple open enter_summ.html on IE u can make simulation but it doesnt put the value of field in 0 like when u upload it into pay machine.

alexistkd
Feb 18th, 2011, 01:41 PM
sorry its hard to me explain everything im from latinamerica

Kor
Feb 18th, 2011, 02:09 PM
OK, I have a look and see what I can do about it.


sorry its hard to me explain everything im from latinamerica

OK, I understand. But it is not a real excuse :), I'm from Romania, and we are, also, Latin people with a Latin language :)
As a web developer you must learn English very well. It is indispensable for this job.

alexistkd
Feb 18th, 2011, 02:12 PM
yeah of course bro, thanks can i pm u my skype or just here

Kor
Feb 18th, 2011, 02:28 PM
i can attach site.zip full true:
Almost 10MB? :eek: What is inside, for God's sake? A Data Base included? :D

alexistkd
Feb 18th, 2011, 02:33 PM
lol just much .wav files and alot .html the important are: enter_summ.html (this one is the file that shows the screenshot i attached) and on folder js/ui/operations.js

Kor
Feb 18th, 2011, 07:55 PM
I can not work properly with your site. FF alerts me that some Flash application wants to turn me towards insecure zones. And alerts nothing. In IE it shows weird (no text, no images), even if performs that alert you are talking about, and so on. But the most annoying thing is that within several seconds, the page redirecst to another and so on. I give up. Your site is entirely out of the standards. I can not understand who will be able to access your site in normal conditions.