Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var voltageValid = document.forms["form"]["voltage"].value;
- var currentValid = document.forms["form"]["current"].value;
- var resistanceValid = document.forms["form"]["resistance"].value;
- var fieldsNull = 0;
- if (voltageValid == null || voltageValid == "") {
- fieldsNull++;
- return false;
- }
- if (currentValid == null || currentValid == "") {
- fieldsNull++;
- return false;
- }
- if (resistanceValid == null || resistanceValid == "") {
- fieldsNull++;
- return false;
- }
- var p = document.createElement('p');
- if (fieldsNull == 3) {
- var errorText = document.createTextNode("Please Only Fill 2 Fields");
- p.appendChild(errorText);
- }
- else {
- var allText = document.createTextNode(voltageValid + ' ' + currentValid + ' ' + resistanceValid);
- p.appendChild(allText);
- }
- document.body.appendChild(p);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement