I have a jsp page that shows the radio button content of a table (clicking on it, the box will be selected ). But here I am unable to select a radio button (with a selection box) at a time. I am showing you the code.
& lt; Table & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input type = "radio" onclick = "document.getElementById ('select1000'). Style.display = (this.checked)? Inline ':' none ';" Name = "license" value = "1000" & gt; 1-1000 & lt; / TD & gt; & Lt; TD & gt; & Lt; Div id = "select1000" style = "display: none" & gt; & Lt; Select ID = "" & gt; & Lt; Option test = "l25" value = "25" & gt; 25 & lt; / Options & gt; & Lt; Option test = "l100" value = "100" & gt; 100 & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input Type = "Radio" onclick = "document.getElementById ('select3000'). Style.display = (this.checked)? Inline ':' none ';" Name = "license" value = "" & gt; 1001-3000 & lt; / TD & gt; & Lt; TD & gt; & Lt; Div id = "select3000" style = "display: none" & gt; & Lt; Select ID = "" & gt; & Lt; Option test = "l1001" value = "1001" & gt; 1001 & lt; / Options & gt; & Lt; Test of choice = "l1075" value = "1075" & gt; 1075 & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input type = "radio" onclick = "document.getElementById ('select5000'). Style.display = (this.checked)? Inline ':' none ';" Name = "license" value = "" & gt; 3001-5000 & lt; / TD & gt; & Lt; TD & gt; & Lt; Div id = "select5000" style = "display: none" & gt; & Lt; Select ID = "" & gt; & Lt; Option test = "l3001" value = "3001" & gt; 3001 & lt; / Options & gt; & Lt; Test of option = "l3075" value = "3075" & gt; 3075 & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; Wherever I am going wrong ... any valuable input will be appreciated.
Can you try to rename the input element:
< Code> & lt; Td> & Lt; Input type = "radio" onclick = "change (this, 'select1000')" name = "license [1]" value = "1000" & gt; 1-1000 & lt; / TD & gt; And create a function:
function changes (T, div) {var ele = document.getElementsByTagName ("div"); Var radio = document.getElementsByName ("License [1]"); (Var i = 0, radio; radio = radio [i]; i ++) {if (! Radio! Check) {if (ele [i] .id! = Div) {ele [i] .style Display = 'none'; }} And {document.getElementById (div) .style.display = 'inline'; }}} I'm not sure this is what you want, but you can see an example.
Comments
Post a Comment