简体   繁体   中英

C# Survey Quiz Logic

I am trying to make a multiple choice quiz and need the value of the input fields that I have below:

<input class="QuizButton" type="radio" name="Q1" value="1" onclick="ShowHide('Question3', 'Question4'), Q3log(1);" > [Question Text....]

How can I make this fully clickable instead of just a radio button? I have tried using tags instead but this did not allow me to do a

Request.Form["Q1"]

request when trying to run my results function.

I'm not sure what you mean by "fully clickable". If what you means is "How do I make the form element respond when either the radio button or it's text are clicked" you can use a <label> to do this.

<input type="radio" id="option1" />
<label for="option1">Option 1</label>
<input type="radio" id="option2" />
<label for="option1">Option 2</label>
<input type="radio" id="option2" />
<label for="option1">Option 2</label>

Note the for attribute. It contains the id of the input that you want to associate it with. Specifying for causes both elements to behave as a single element for the purposes of UI interaction.

Wrap your input into label tags, that way the whole text + radio button will be clickable.

            <label>
            <input class="QuizButton" type="radio" name="Q1" value="1" onclick="ShowHide('Question3', 'Question4'), Q3log(1);">
             [Question Text....]
            </label>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM