يكون التكست يسمح بارقام مثل هذه
24325.65
4543
43456.2
ارقام نقدية يعني نقطة واحدة فقط
يكون التكست يسمح بارقام مثل هذه
24325.65
4543
43456.2
ارقام نقدية يعني نقطة واحدة فقط
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script>
function check(evt, v) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 44))return false;
if(charCode == 44 && v.indexOf(",")!= -1)return false;
return true;
}
</script>
</head>
<body>
<p><input type="text" name="T1" size="20" onkeypress="return check(event, this.value);"></p>
</body>
</html>شكل آخر باستخدام isNaN
<html>
<head>
<title></title>
<script type="text/javascript">
<!--
function isInteg(obj){
if(isNaN(obj.value)){
var test = obj.value.substring(0, obj.value.length-1);
document.form1.textfield.value = test;
return false;
}
return true;
}
// -->
</script>
</head>
<body>
<form name="form1">
<input type="text" name="textfield" onKeyUp="isInteg(this);">
</form>
</body>
</html>Do as I say, not as I do
We are Anonymous. We are Legion. We don't forgive. We don't forget
شكرا لكم اخواني .
بسم الله الرحمن الرحيم
تمت الإجابة على الموضوع
إدارة الفريق العربي للبرمجة
Do as I say, not as I do
We are Anonymous. We are Legion. We don't forgive. We don't forget
المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية
جارٍ التحقق من المتواجدين…