בעיה קטנה
איך אני "מאחד" את הקטע הזה:
איך אני "מאחד" את הקטע הזה:
if(e==´´) { document.form1.age.focus() alert(´לא רשמת גיל´) return(false)
עם הקטע הזה??var x=document.form1.age.value var anum=/(^\d+$)|(^\d+\.\d+$)/ if (anum.test(x)) testresult=true else{ alert("בתיבת הגיל ציין מספרים בלבד!") testresult=false } return (testresult) }
לדוגמא שזה יהיה ככה..if(e==´´) { document.form1.age.focus() alert(´לא רשמת גיל´) return(false) else var x=document.form1.age.value var anum=/(^\d+$)|(^\d+\.\d+$)/ if (anum.test(x)) testresult=true else{ alert("בתיבת הגיל ציין מספרים בלבד!") testresult=false } return (testresult) }
כלומר - שאם לא מוזן שום דבר לטופס זה מקפיץ הודעה, ואם מוזן לשדה הזה ערך באותיות ולא במספרים - זה גם יקפיץ ת´הודעה.. איך עושים?