javascript - HTML select a row under the <td> tag in UIWebView -


i have uiwebview in have loaded htmlstring contains text in table format under tag. tag inside tag. under tag. need change color of text on tap.

code :

<tr id = '1' valign=\"top\">   <td>     <p>       <a href = '#1'> text </a>     </p>   </td>   <td>     <p>       <a href = '#1'> translation </a>     </p>   </td> </tr> 

what need when tap on "text" or "translation" text color should change.

i writing javascript code change color.

<script> var el = document.getelementbyid(\"%d\");       window.onload = function () {      window.scrollto(20,el.offsettop);       el.style.color=\"red\";     }  </script> 

please help.

update:

this html file replacing above given "tr" tag ###content###

<html>     <head>         <style type='text/css'>          a:link {             text-decoration : none;             color: black;         }          a:visited {             color: black;         }          a:hover {             color: red;         }           table {             table-layout: fixed;             width: 280px;         }         html,body {             margin: 0;padding: 0;         }         html {             display: table;         }         body {             font-family:'msh-quraan1';             font-size:17px;             display: table-cell;             vertical-align: middle;             padding: 10px;             text-align: center;-webkit-text-size-adjust: none;         }         </style>     </head>     <body>         <table>             ###content###         </table>     </body> </html> 

why use javascript?

trying using css

tr #1:active{ color:red} 

i no expert on javascript try this:

<script>      document.getelementbyid('1').onclick = changecolor;         function changecolor() {         document.body.style.color = "red";         return false;     }     </script> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -