Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1<html>
- <head>
- <title>My calculator</title>
- <!-- <script type="text/javascript"> -->
- <script>
- function call(click_id)
- {
- var v1=parseFloat(document.getElementById("ip1").value);
- var v2=parseFloat(document.getElementById("ip2").value);
- if(isNaN(v1) || isNaN(v2)) alert("enter a valid number");
- else if(click_id=="add") document.getElementById("output").value=v1+v2;
- else if(click_id=="sub") document.getElementById("output").value=v1-v2;
- else if(click_id=="mul") document.getElementById("output").value=v1*v2;
- else if(click_id=="div") document.getElementById("output").value=v1/v2; }
- </script>
- </head>
- <body>
- <center> <h1> A SIMPLE CALCULATOR PROGRAM</h1>
- <table style="background-color:yellow" align=="center">
- <tr>
- <td>
- <form method="get" action="">
- <div width=50% align="center">
- <label>OP1<input type="text" id="ip1"/></label>
- <label>op2<input type="text" id="ip2"/></label>
- <label>total<input type="text" id="output"/></label>
- </div>
- <br>
- <div width=50% align="center">
- <input type="button" value="+" id="add" onclick="call(this.id)"/>
- <input type="button" value="-" id="sub" onclick="call(this.id)"/>
- <input type="button" value="*" id="mul" onclick="call(this.id)"/>
- <input type="button" value="/" id="div" onclick="call(this.id)"/>
- <input type="reset" value="clear"/>
- </div>
- </form>
- </td>
- </tr>
- </table>
- </center>
- </body>
- </html>
- 2222222
- <html>
- <head>
- </head>
- <body>
- <table align="center" border=1>
- <tr><td>number</td><td>square</td><td>cube</td></tr>
- <!-- <script type="text/javascript"> -->
- <script>
- for(var n=0; n<=10; n++)
- {
- document.write( "<tr><td>" + n + "</td><td>" + n*n + "</td><td>" + n*n*n + "</td></tr>" ) ;
- }
- </script>
- </table>
- </body>
- </html>
- 3333333333333
- <html>
- <body>
- <p id="demo"></p>
- <script>
- var var1 = setInterval(inTimer, 1000);
- var size = 5;
- var ids = document.getElementById("demo");
- function inTimer()
- {
- ids.innerHTML = 'TEXT GROWING';
- ids.setAttribute('style', "font-size: " + size + "px; color: red");
- size += 5;
- if(size >= 50 )
- {
- clearInterval(var1);
- var2 = setInterval(deTimer, 1000);
- }
- }
- function deTimer()
- { size -= 5;
- ids.innerHTML = 'TEXT SHRINKING';
- ids.setAttribute('style', "font-size: " + size + "px; color: blue");
- if(size == 5 )
- {
- clearInterval(var2);
- }
- }
- </script>
- </body>
- </html>
- 44444444444444
- <html>
- <head>
- <script>
- function findSolution()
- {
- findVowel();
- reverseNumber();
- }
- function findVowel()
- {
- var str1;
- str1 = document.getElementById('str1').value;
- var i, ch, index;
- index = -1;
- for ( i = 0; i < str1.length; i++ )
- {
- ch = str1.charAt(i);
- switch (ch) {
- case 'a' :
- case 'e' :
- case 'i' :
- case 'o' :
- case 'u' :
- case 'A' :
- case 'E' :
- case 'I' :
- case 'O' :
- case 'U' :
- index = i;
- break;
- }
- if ( index != -1 ) break;
- }
- if ( index == -1 )
- document.getElementById('result1').innerHTML = 'Vowel not found';
- else
- document.getElementById('result1').innerHTML = 'Location of first vowel : ' + index;
- }
- function reverseNumber()
- {
- var str2;
- str2 = document.getElementById('str2').value;
- var i, ch, index, l;
- index = -1;
- var result2 = '';
- l = str2.length;
- for ( i = 0; i < l; i++ )
- result2 = result2 + str2.charAt(l-i-1);
- document.getElementById('result2').innerHTML = 'Number in reverse order : ' + result2;
- }
- </script>
- </head>
- <body style='text-align: center'>
- <br>
- <br>
- <br>
- String 1 :
- <input type='text' id='str1' size='20' />
- <br>
- <br>
- String 2 :
- <input type='text' id='str2' size='20' />
- <br>
- <br>
- <input type='button' value='Submit' onclick='findSolution()' />
- <br>
- <br>
- <div id='result1'></div>
- <br>
- <br>
- <div id='result2'></div>
- </body>
- </html>
- 55555555555555
- <?xml-stylesheet type="text/css" href="6.css" ?>
- <!DOCTYPE HTML>
- <html>
- <head>
- <h1> STUDENTS DESCRIPTION </h1>
- </head>
- <students>
- <student>
- <USN>USN : 1CG15CS001</USN>
- <name>NAME : SANTHOS</name>
- <college>COLLEGE : CIT</college>
- <branch>BRANCH : Computer Science and Engineering</branch>
- <year>YEAR : 2015</year>
- <e-mail>E-Mail : santosh@gmail.com</e-mail>
- </student>
- <student>
- <USN>USN : 1CG15IS002</USN>
- <name>NAME : MANORANJAN</name>
- <college>COLLEGE : CITIT</college>
- <branch>BRANCH : Information Science and Engineering</branch>
- <year>YEAR : 2015</year>
- <e-mail>E-Mail : manoranjan@gmail.com</e-mail>
- </student>
- <student>
- <USN>USN : 1CG15EC101</USN>
- <name>NAME : CHETHAN</name>
- <college>COLLEGE : CITIT</college>
- <branch>BRANCH : Electronics and Communication Engineering
- </branch>
- <year>YEAR : 2015</year>
- <e-mail>E-Mail : chethan@gmail.com</e-mail>
- </student>
- </students>
- </html>
- 555555555555css
- student{
- display:block; margin-top:10px; color:Navy;
- }
- USN{
- display:block; margin-left:10px;font-size:14pt; color:Red;
- }
- name{
- display:block; margin-left:20px;font-size:14pt; color:Blue;
- }
- college{
- display:block; margin-left:20px;font-size:12pt; color:Maroon;
- }
- branch{
- display:block; margin-left:20px;font-size:12pt; color:Purple;
- }
- year{
- display:block; margin-left:20px;font-size:14pt; color:Green;
- }
- e-mail{
- display:block; margin-left:20px;font-size:12pt; color:Blue;
- 6666666666
- <?php
- print "<h3> REFRESH PAGE </h3>";
- $name="counter.txt";
- $file = fopen($name,"r");
- $hits= fscanf($file,"%d");
- fclose($file);
- $hits[0]++;
- $file = fopen($name,"w");
- fprintf($file,"%d",$hits[0]);
- fclose($file);
- print "Total number of views: ".$hits[0];
- ?>
- 777777777777
- l>
- <head>
- // <meta http-equiv="refresh" content="1"/>
- <style>
- p {
- color:white;
- font-size:90px;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- }
- body{
- background-color:black;
- }
- </style>
- <p> <?php
- date_default_timezone_set('Asia/Kolkata');
- $currentTime = date( ' h:i:s A', time () );
- echo $currentTime;
- ?> </p>
- </head>
- </html>
- 999999999999999
- <?php
- error_reporting(0);
- $states = array('Mississippi','Alabama','Texas','Massachusetts','Kansas');
- $stateList = array();
- $arrlength = count($states);
- // ends with xas
- for ( $x = 0; $x < $arrlength; $x++ )
- if ( strcmp(strrchr($states[$x],'xas'),'xas') == 0 )
- array_push($stateList,$states[$x]);
- // Starts with K, ends with s
- for ( $x = 0; $x < $arrlength; $x++ )
- {
- $newstr = strtoupper($states[$x]);
- $revStr = strrev($newstr);
- if ( strcmp($newstr[0],"K") == 0 && strcmp($revStr[0],"S") == 0 )
- array_push($stateList,$states[$x]);
- }
- // Starts with M ends with s
- for ( $x = 0; $x < $arrlength; $x++ )
- {
- $newStr = $states[$x];
- $revStr = strrev($states[$x]);
- if ( strcmp($newStr[0],"M") == 0 && strcmp($revStr[0],"s") == 0 )
- array_push($stateList,$states[$x]);
- }
- // Ends with a
- for ( $x = 0; $x < $arrlength; $x++ )
- {
- $revStr = strrev($states[$x]);
- if ( strcmp($revStr[0],"a") == 0 )
- array_push($stateList,$states[$x]);
- }
- for ( $x = 0; $x < count($stateList); $x++ )
- echo $stateList[$x]."\r\n";
- ?>
- 10101010101010
- <?php
- $host = 'localhost:3306';
- $username = 'root';
- $password = '';
- $dbName = '15cs553';
- $connection = mysqli_connect($host,$username,$password,$dbName);
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to database : " . mysqli_connect_error();
- }
- else
- echo "<h1 style='text-align: center'>Connection successful ...</h1>".'<br>';
- $sql = "select * from students order by usn";
- $resultSet = $connection->query($sql);
- if ( $resultSet->num_rows > 0)
- {
- echo "<table border='1' style='margin: auto' >";
- echo "<tr><th>USN</th><th>Name</th></tr>";
- while($row = $resultSet->fetch_assoc())
- {
- echo "<tr>";
- echo "<td>".$row["usn"]."</td>";
- echo "<td>".$row["name"]."</td>";
- echo "</tr>";
- }
- echo "</table>";
- }
- $resultSet->close();
- $connection->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement