Click here to Skip to main content
15,923,087 members
Home / Discussions / JavaScript
   

JavaScript

 
Questionhow to open the minimized window after refreshing the page? Pin
dayakar_dn2-Nov-11 21:16
dayakar_dn2-Nov-11 21:16 
AnswerRe: how to open the minimized window after refreshing the page? Pin
Dennis E White7-Nov-11 6:14
professionalDennis E White7-Nov-11 6:14 
AnswerRe: how to open the minimized window after refreshing the page? Pin
jkirkerx19-Nov-11 20:17
professionaljkirkerx19-Nov-11 20:17 
QuestionAny body know the basic components to a javascript slideshow? Pin
swydell30-Oct-11 14:43
swydell30-Oct-11 14:43 
AnswerRe: Any body know the basic components to a javascript slideshow? Pin
Manfred Rudolf Bihy30-Oct-11 22:59
professionalManfred Rudolf Bihy30-Oct-11 22:59 
QuestionStop Text From Being Converted Into Links Pin
ASPnoob28-Oct-11 23:32
ASPnoob28-Oct-11 23:32 
AnswerRe: Stop Text From Being Converted Into Links Pin
Richard MacCutchan29-Oct-11 0:06
mveRichard MacCutchan29-Oct-11 0:06 
AnswerRe: Stop Text From Being Converted Into Links Pin
Dennis E White29-Oct-11 15:13
professionalDennis E White29-Oct-11 15:13 
QuestionIssue w/ Javascript inside 64 bit browser Pin
bgates197026-Oct-11 5:26
bgates197026-Oct-11 5:26 
AnswerRe: Issue w/ Javascript inside 64 bit browser Pin
Dennis E White27-Oct-11 9:08
professionalDennis E White27-Oct-11 9:08 
AnswerRe: Issue w/ Javascript inside 64 bit browser Pin
jsc4228-Oct-11 1:38
professionaljsc4228-Oct-11 1:38 
QuestionHTMLInput.name Pin
Ali Al Omairi(Abu AlHassan)25-Oct-11 21:40
professionalAli Al Omairi(Abu AlHassan)25-Oct-11 21:40 
AnswerRe: HTMLInput.name Pin
Gerben Jongerius25-Oct-11 22:10
Gerben Jongerius25-Oct-11 22:10 
GeneralRe: HTMLInput.name Pin
Ali Al Omairi(Abu AlHassan)25-Oct-11 23:41
professionalAli Al Omairi(Abu AlHassan)25-Oct-11 23:41 
QuestionJavascript validate the master and content page Pin
sathyan_829423-Oct-11 2:45
sathyan_829423-Oct-11 2:45 
AnswerRe: Javascript validate the master and content page Pin
DaveAuld23-Oct-11 3:41
professionalDaveAuld23-Oct-11 3:41 
Firstly, Why did you put your question in a code block, doesn't look very clever............


Ok, so back to your question;
You can use the object onChange to call a javascript function to validate the content as each element changes.

You could also use a button when you submit to check each element. The code below is a sample to help you get going, but there are heaps of examples on the net. You could take all the javascript out of the lower script block and place it in a reference file as shown in the upper script block entry

XML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <script type="text/javascript" src="js/thejsfile.js"></script>

</head>
<body>

    <table>
        <tr><td>Name:</td><td><input id="textName" type="text" onchange="validateName()"/></td><td id="nameValidMessage"></td></tr>
        <tr><td>Age:</td><td><input id="textAge" type="text" onchange="validateAge()"/></td><td id="ageValidMessage"></td></tr>
    </table>
    <input id="ButtonGo" type="button" value="Go" onclick="go_click()"/>
    <script type="text/javascript">

        function validateAge() {
            var valid = false
            //write you code to validate the age
            //set valid to true if all ok

            if (textAge.value == "99") { valid = true; }

            //update the page message
            if (!valid) {
                ageValidMessage.innerHTML = "Invalid Age";
            }
            else {
                ageValidMessage.innerHTML = "";
            }

            return valid
        }

        function validateName() {
            var valid = false
            //write you code to validate the name
            //set valid to true if all ok

            if (textName.value == "Dave") { valid = true; }

            //update the page message
            if (!valid) {
                nameValidMessage.innerHTML = "Invalid Name";
            }
            else {
                nameValidMessage.innerHTML = "";
            }

            return valid
        }

        function go_click() {
            var valid = false
            //Do a validation of Name and Age
            valid = validateName() && validateAge()

            if (valid) {
                //Do what you need to if all ok
            }

        }
    </script>
</body>
</html>

Dave
Find Me On: Web|Facebook|Twitter|LinkedIn

Folding Stats: Team CodeProject


AnswerRe: Javascript validate the master and content page Pin
MalarGayu9-Nov-11 15:33
MalarGayu9-Nov-11 15:33 
QuestionWhere is the data behind the page? Pin
LeonardoDaga22-Oct-11 0:37
LeonardoDaga22-Oct-11 0:37 
AnswerRe: Where is the data behind the page? Pin
Richard MacCutchan22-Oct-11 1:48
mveRichard MacCutchan22-Oct-11 1:48 
GeneralRe: Where is the data behind the page? Pin
LeonardoDaga22-Oct-11 6:12
LeonardoDaga22-Oct-11 6:12 
GeneralRe: Where is the data behind the page? Pin
Richard MacCutchan22-Oct-11 6:26
mveRichard MacCutchan22-Oct-11 6:26 
GeneralRe: Where is the data behind the page? Pin
DaveAuld22-Oct-11 8:21
professionalDaveAuld22-Oct-11 8:21 
GeneralRe: Where is the data behind the page? Pin
Richard MacCutchan22-Oct-11 21:51
mveRichard MacCutchan22-Oct-11 21:51 
GeneralRe: Where is the data behind the page? Pin
DaveAuld22-Oct-11 21:59
professionalDaveAuld22-Oct-11 21:59 
GeneralRe: Where is the data behind the page? Pin
Richard MacCutchan23-Oct-11 2:17
mveRichard MacCutchan23-Oct-11 2:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.