I need jsp function for search data(text) inside a html table. not a my sql table.

ex: inside a table "<table><tr><td>some text here</td></tr></table>" i have several text. i need jsp function to search one of the text and highlight it with the position where the word is.

or can u pls suggest the way of finding the text in a html table.

please help to solve this issue

Recommended Answers

All 8 Replies

JSP is server-side, you probably want to use JavaScript instead

I need Java Script function for search data(text) inside a html table. not a my sql table. (table size is fixed)

ex: inside a table "<table><tr><td>some text here</td></tr></table>" i have several text. i need Java Script function to search one of the text and highlight it with the position where the word is.

or can u pls suggest the way of finding the text in a html table.

please help to solve this issue

If you assign an id to the table, you will be able to search through it using DOM.

I need Java Script function for search data(text) inside a html table. not a my sql table. (table size is fixed)

Make up you mind what technology you want to use and do not forget to support your claim by existing coding you already did as this is no 24/7 service "give me code"!

I need Java Script function for search data(text) inside a html table. not a my sql table. (table size is fixed)

ex: inside a table "<table><tr><td>some text here</td></tr></table>" i have several text. i need Java Script function to search one of the text and highlight it with the position where the word is.

or can u pls suggest the way of finding the text in a html table.

please help to solve this issue

Please send me the Java Script Code

Post moved to JavaScript, because of poster confusion with JSP - Java Server Pages

Would have to be the worst poster I've seen.

!DOCTYPE html> <html> <head> <title>Tabela</title> <style> table,tr,th, td { border: 1px solid black; border-collapse: collapse; } table{ width:50%; } input{ text-align:center; } </style> <script> function shfaq(){ var n=parseInt(document.getElementById('nr').value); var a=document.getElementById('tabela'); var x="<table><tr><th>NR</th><th>Emer Produkti</th><th>Sasia</th><th>Cmimi</th><th>Vlera</th></tr>"; var i; for(i=1;i<=n;i++){ x+="<tr><td>"+i+"</td><td><input type='text' id='artikulli"+i+"'/></td><td><input type='text' id='sasia"+i+"' onChange='shto_ne_vlere(sasia"+i+",cmimi"+i+",vlera"+i+")'/></td><td><input type='text' id='cmimi"+i+"' onChange='shto_ne_vlere(sasia"+i+",cmimi"+i+",vlera"+i+")'/></td><td><input type='text' id='vlera"+i+"' value='0' readonly/></td></tr>"; } if(n>0) x+="<tr><th colspan='4'>Totali:</th><td><input type='text' id='nr_totali' value='0' readonly/></td></tr>"; x+="</table>"; a.innerHTML=x; } function shto_ne_vlere(sasi,cmimi,vlera){ var z=parseInt(sasi.value); var y=parseInt(cmimi.value); vlera.value=z*y; if(vlera.value!='NaN') document.getElementById('nr_totali').value=parseInt(document.getElementById('nr_totali').value)+parseInt(vlera.value); } </script> </head> <body> Vendos numrin e artikujve:<input type="text" id="nr"/> <input type="button" value="KRIJO" onClick="shfaq();"/></br></br> <div id="tabela"> </div> </body> </html>
CAN SOMEONE HELP ME FINDING THE RIGHT TOTTAL BECAUSE WHEN I CHANGE THE VALUES OF COL IT ADDS UP WITH THE LAST ONE

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.