javascript - Show/hide a by link -
When I click on a link, I want to show an element that has all the link questions and answers to each question in all Both questions and answers are taken from the database so I have to identify them.
The problem is that when I work on the link, it does not work and nothing happens
this code is:
& Lt ;? Php $ req = 'select * from plot queue, curse c where q.id_quest ='. $ Data ['id_q']. ' And q.id_curs = c.id_cursus'; $ Result = mysql_query ($ req) or die ('erroor sql! & Lt; br & gt;' $ sql2. '& Lt; br & gt;' mysql_error ()); $ Currentid = $ data ['id_q']; $ Test = 'test'; . $ Currentrep = $ currentid $ test; Echo '& lt; An id = '. $ Currentid 'Href = "javascript: toggle (,' $ currentrep .. '' $ currentid .. ');" & Gt; & Lt; P & gt; & Lt; H8 & gt; Question: & lt; / B & gt; '. $ Data ['int_question']. ' & Lt; / H8> & Lt; Br> & Lt; / A & gt; '; Echo '& lt; div id = ' $ Currentrep 'Style = "display: none" & gt; & Lt; B & gt; Ra pence & lt; / B & gt; : '. $ Data ['representative']. ' & Lt; Nbsp & gt; '; ? & Gt; To pass the string to the JS function, you must save the quote correctly:
>
l & lt; A id = "'. $ Currentid.'" Href = "Javascript: Toggle (\. '$ Currentid.' \ ', \'. $ Currentrep. '\');" & Gt; & Lt; P & gt; & Lt; H8 & gt; Question: & lt; / B & gt; '. $ Data ['int_question']. ' & Lt; / H8> & Lt; Br> & Lt; / A & gt; '; Echo '& lt; div id = "'. $ currentrep.' 'style =" display: none "& gt; & lt; b & gt; RA pence & lt; / b & gt;:'. $ data ['representative'] ' << Code>
Comments
Post a Comment