Thursday, March 10, 2011

Onclick event on Table, tr and td

Hello Friends,

I share the knowledge about onclick event for table, tr and td.

for e.g.
<table>
       <tr>
             <td id="td1" onclick="clickMe()">Hello</td>
             <td id="td2" onclick="clickMe(id)">How r u?</td>
         </tr>
</table>
<script>
      function clickMe(tdId){
                     alert(document.getElementById(tdId).id);
                     alert(document.getElementById(tdId).innerHTML);
        }
</script>

same way you can set click event on tr and table and call function.
Also you can write inline function in onclick event so no need to write explict function for the event.

for e.g.
<td id='td1' onclick="alert(document.getElementById('td1').innerHTML)" > Hello Friends </td>

Wednesday, February 16, 2011

MySQL- User exist then also error cause in connection string

Hello,
In this post I will share some logical error while your connecting MySQL database with any technologies like java,dot net etc.
If you create a user in mysql for accessing database/table/column etc.
and you using this user for accessing from webapp or desktop.
And you getting some error like if user name was newuser, host name was localhost and password and privileges are set for that user then your connection string for localhost like jdbc:mysql://localhost:3306/dbname
username=newuser, password = <password>,

so now you have create user in mysql like username=newuser, host name=% etc,
It might be some time causing error for localhost so for that you have create same user with same name, password and privileges but the host name was set to localhost.

now in your local system it will be run same like on another server system.
hope you got some idea by this post.
thank you.