复选框的javascript中的自定义验证 [英] custom validtion in javascript of checkbox

查看:70
本文介绍了复选框的javascript中的自定义验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是开发领域的新手..我在验证方面遇到问题..这是我的网页图..

Hi, i am new in development field..i have problem regarding validation..this is my webpage diagram here..

NoOfAnswers:12345671234567***here i have a dropdownlist of seven answers...every answer is associated with textbox and checkbox...here above textbox has been written as 1 t0 7...previous one just as no of answrs in DRP frm 1 to7..pls i want to put validation on checkbox..so that we could skip to click on  only one answer..so pls help me out..if i click on 3 answers frm DRP thn we will not be allowed to skip it..at least on answer must be checked..pls help me out..

[CbxAnswer1]
[CbxAnswer2]
[CbxAnswer3]
[CbxAnswer4]
[CbxAnswer5]
[CbxAnswer6]
[CbxAnswer7]
thanks .....

推荐答案

您会在我最近的解决方案
You will find some idea in my recent solution how to save the selected checkbox text into database[^].

—SA


我不清楚您的问题,但您想在下拉列表中进行验证. >

I didn''t get your question clearly, but you want validation on drop down list right.. just go through this..


<select id="selctionlist" name="Answer to:">
   <option>1</option>
   <option>2</option>
   <option>3</option>
   <option>4</option>
   </select>
   <input type="text" /><input type="checkbox" name="c" /><br />
    <input type="text" /><input type="checkbox" name="c" /><br />
     <input type="text" /><input type="checkbox" name="c" /><br />
      <input type="text" /><input type="checkbox" name="c" /><br />
      <input type="button" onclick="validate()" /></select>


function validate()
        {

            var i = selctionlist.selectedIndex;
            if (c[i].checked == false)
            alert("Please check box" +(i+1));
            
            
       }


这篇关于复选框的javascript中的自定义验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆