select checkbox page load
javascript_onload_checkbox :
This javascript selects the checkbox using the indexof in pageload event
<html> <head> <script type="text/javascript"> var arr1 = "acd"; var arrval = ""; function load() { window.status="Page is loaded here"; if ((searcharray=arr1.indexOf("a"))!=-1) { arrval="its A"; callalert(); document.test.checkgroup[0].checked=true; } if ((searcharray=arr1.indexOf("b"))!=-1) { arrval="its B"; callalert(); document.test.checkgroup[1].checked=true; } if ((searcharray=arr1.indexOf("c"))!=-1) { arrval="its C"; callalert(); document.test.checkgroup[2].checked=true; } if ((searcharray=arr1.indexOf("d"))!=-1) { arrval="its D"; callalert(); document.test.checkgroup[3].checked=true; } } function clicked() { alert("Changing value manually") } function callalert() { alert (arrval); } document.write(’THE GIVEN VALUE OR ARRAY IS<br>’); document.write(arr1); </script> </head> <body onload="load()"> </body> </html> <form name="test"> A:<input type="checkbox" name="checkgroup" onclick="clicked()"/><br /> B:<input type="checkbox" name="checkgroup" onclick="clicked()"/><br /> C:<input type="checkbox" name="checkgroup" onclick="clicked()"/><br /> D:<input type="checkbox" name="checkgroup" onclick="clicked()"/><br /> </form> </html>
Browser full information javascript
To get full information on browser :
Like:
Browser name = Firefox
Full version = 2
Major version = 2
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Got a good script to achieve the above Use :
<html> <SCRIPT LANGUAGE=”JavaScript”> var nVer = navigator.appVersion; var nAgt = navigator.userAgent; var browserName = ”; var fullVersion = 0; var majorVersion = 0; // In Internet Explorer, the true version is after “MSIE” in userAgent if ((verOffset=nAgt.indexOf(”MSIE”))!=-1) { browserName = “Microsoft Internet Explorer”; fullVersion = parseFloat(nAgt.substring(verOffset+5)); majorVersion = parseInt(”+fullVersion); } // In Opera, the true version is after “Opera” else if ((verOffset=nAgt.indexOf(”Opera”))!=-1) { browserName = “Opera”; fullVersion = parseFloat(nAgt.substring(verOffset+6)); majorVersion = parseInt(”+fullVersion); } // In Firefox, the true version is after “Firefox” else if ((verOffset=nAgt.indexOf(”Firefox”))!=-1) { browserName = “Firefox”; fullVersion = parseFloat(nAgt.substring(verOffset+8)); majorVersion = parseInt(”+fullVersion); } // In most other browsers, “name/version” is at the end of userAgent else if ( (nameOffset=nAgt.lastIndexOf(’ ‘)+1) < (verOffset=nAgt.lastIndexOf(’/')) ) { browserName = nAgt.substring(nameOffset,verOffset); fullVersion = parseFloat(nAgt.substring(verOffset+1)); if (!isNaN(fullVersion)) majorVersion = parseInt(”+fullVersion); else {fullVersion = 0; majorVersion = 0;} } // Finally, if no name and/or no version detected from userAgent… if (browserName.toLowerCase() == browserName.toUpperCase() || fullVersion==0 || majorVersion == 0 ) { browserName = navigator.appName; fullVersion = parseFloat(nVer); majorVersion = parseInt(nVer); } document.write(’Browser name = ‘+browserName+’<br>’); document.write(’Full version = ‘+fullVersion+’<br>’); document.write(’Major version = ‘+majorVersion+’<br>’); document.write(’navigator.appName = ‘+navigator.appName+’<br>’); document.write(’navigator.userAgent = ‘+navigator.userAgent+’<br>’); </script> <a href=”http://avancezone.com”>avancezone</a> </html>
Javascript to know browser name and browser version
<html> <body> <script type="text/javascript"> var browser=navigator.appName; var b_version=navigator.appVersion; var version=parseFloat(b_version); var cdname=navigator.appCodeName; document.write("Browser name: "+ browser); document.write("<br />"); document.write("code name: "+ cdname); document.write("<br />"); document.write("Browser version: "+ version); </script> </body> </html>
Connection of Database from Linux shell
mysql advantages and Connectivity from unix / linux shell
•Ability to handle an unlimited number of simultaneous users.
•Capacity to handle 50,000,000+ records.
•Very fast command execution, perhaps the fastest to be found on the market.
•Easy and efficient user privilege system.
Connect mysql from linux shell :
shell> mysql ?u arvind –p
where arvind is the username
(might work for root for username)
Enter password when prompted.
To select database in mysql
mysql> use mydb;
Result:
Database changed Mydb>
You now are connected to mydb database
Create table in mysql :
mysql> CREATE TABLE test ( > name VARCHAR (15), > email VARCHAR (25), > phone_number
INT, > ID INT NOT NULL AUTO_INCREMENT, > PRIMARY KEY (ID));
Insert command in mysql :
mysql> INSERT INTO test VALUES mysql> (’Bugs Bunny’, ‘carrots@devshed.com’, mysql> 5554321,NULL);
Delete a record from mysql table
mysql> DELETE FROM test mysql> WHERE (name = “arvind”);
Update a record in mysql database :
mysql> UPDATE test SET name = ‘arvind1′ mysql> WHERE name = “arvind2″;
arvind2 will be replace with arvind1
selection and order by mysql :?
mysql> SELECT * FROM test WHERE mysql> (name = “arvind”) ORDER BY mysql>
phone_number;
MySql php Connection
<div id="Avance Zone"> <?php echo "php started....."; $sqlConn = mysql_connect('localhost', 'dbuname', 'dbpwd'); //this is comment //dbuname is the database username //dbpwd is the database password if (!$sqlConn) { die('Connect error'.mysql_error()); //the error will be displayed if php cannt connet to your database } else { echo "Connected"; //connected will be displayed once your php connected with mysql } //$query = "show databases;"; //select which database you want to edit $db=mysql_select_db("dbname"); //dbname is the database name if(!$db) { die('mysql select error'.mysql_error()); //if db cannot be connected this shows this message } //select the table $result = mysql_query("select * from R"); $numofrows = mysql_num_rows($result); echo "No of rows".$numofrows; echo "<br>"; echo "<table border='1'> <tr> <th>FirstName</th> <th>Lastname</th> <th>City</th> <th>Mobile</th> <th>email</th> <th>pre_emp</th> <th>Experience</th> <th>Qualification</th> <th>college</th> <th>skill set</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['first_name'] . "</td>"; echo "<td>" . $row['last_name'] . "</td>"; echo "<td>" . $row['city'] . "</td>"; echo "<td>" . $row['mobile'] . "</td>"; echo "<td>" . $row['email1'] . "</td>"; echo "<td>" . $row['department'] . "</td>"; echo "<td>" . $row['Experience'] . "</td>"; echo "<td>" . $row['previous_employer'] . "</td>"; echo "<td>" . $row['college'] . "</td>"; echo "<td>" . $row['skillset'] . "</td>"; echo "</tr>"; } echo "</TABLE>"; mysql_close($sqlConn); ?> </div>
