SHARE
TWEET

WEB

ohhmee Dec 2nd, 2019 167 in 25 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1
  2. <html>
  3. <head>
  4. <title>My calculator</title>
  5. <script type="text/javascript">
  6. function call(click_id)
  7. {
  8. var v1=parseFloat(document.getElementById("ip1").value);
  9. var v2=parseFloat(document.getElementById("ip2").value);
  10. if(isNaN(v1) || isNaN(v2))
  11. alert("enter a valid number");
  12. else if(click_id=="add")
  13. document.getElementById("output").value=v1+v2;
  14. else if(click_id=="sub")
  15. document.getElementById("output").value=v1-v2;
  16. else if(click_id=="mul")
  17. document.getElementById("output").value=v1*v2;
  18. else if(click_id=="div")
  19. document.getElementById("output").value=v1/v2;
  20. }
  21. </script>
  22. </head>
  23. <body>
  24. <center>
  25. <h1> A SIMPLE CALCULATOR PROGRAM</h1>
  26. <table style="background-color:yellow" align=="center">
  27. <tr>
  28. <td>
  29. <form method="get" action="">
  30. <div width=50% align="center">
  31. <label>OP1<input type="text" id="ip1"/></label>
  32. <label>op2<input type="text" id="ip2"/></label>
  33. <lablel>total<input type="text" id="output"/></label>
  34. </div>
  35. <br>
  36. <div width=50% align="center">
  37. <input type="button" value="+" id="add" onclick="call(this.id)"/>
  38. <input type="button" value="-" id="sub" onclick="call(this.id)"/>
  39. <input type="button" value="*" id="mul" onclick="call(this.id)"/>
  40. <input type="button" value="/" id="div" onclick="call(this.id)"/>
  41. <input type="reset" value="clear"/>
  42. </div>
  43. </form>
  44. </td>
  45. </tr>
  46. </table>
  47. </center>
  48. </body>
  49. </html>
  50.  
  51. ------------------------------------------------------------------------------------------------------------------------------------
  52.  
  53. 2
  54. <html>
  55. <head>
  56. </head>
  57. <body>
  58. <table align="center" border=1>
  59. <tr><td>number</td><td>square</td><td>cube</td></tr>
  60. <script type="text/javascript">
  61. for(var n=0; n<=10; n++)
  62. {
  63. document.write( "<tr><td>" + n + "</td><td>" + n*n + "</td><td>" + n*n*n
  64. + "</td></tr>" ) ;
  65. }
  66. </script>
  67. </table>
  68. </body>
  69. </html>
  70.  
  71. ---------------------------------------------------------------------------------------------------------------------------------------
  72.  
  73. 3
  74. <html>
  75. <body>
  76. <p id="demo"></p>
  77. <script>
  78. var var1 = setInterval(inTimer, 1000);
  79. var size = 5;
  80. var ids = document.getElementById("demo");
  81. function inTimer() {
  82. ids.innerHTML = 'TEXT GROWING';
  83. ids.setAttribute('style', "font-size: " + size + "px; color: red");
  84. size += 5;
  85. if(size >= 50 ){
  86. clearInterval(var1);
  87. var2 = setInterval(deTimer, 1000);
  88. }
  89. }
  90. function deTimer() {
  91. size -= 5;
  92. ids.innerHTML = 'TEXT SHRINKING';
  93. ids.setAttribute('style', "font-size: " + size + "px; color: blue");
  94. if(size == 5 ){
  95. clearInterval(var2);
  96. }
  97. }
  98. </script>
  99. </body>
  100. </html>
  101.  
  102. -------------------------------------------------------------------------------------------------------------------------------------
  103.  
  104. 4
  105. <html>
  106. <body>
  107. <script type="text/javascript">
  108. var str = prompt("Enter the Input","");
  109. if(isNaN(str))
  110. {
  111. str = str.toUpperCase();
  112. for(var i = 0; i < str.length; i++) {
  113. var chr = str.charAt(i);
  114. if(chr == 'A' || chr == 'E' || chr == 'I' || chr == 'O' || chr == 'U')break;
  115. }
  116. if( i < str.length )
  117. alert("The position of the left most vowel is "+(i+1));
  118. else
  119. alert("No vowel found in the entered string");
  120. }
  121. else
  122. {
  123. var num,rev=0,remainder;
  124. num = parseInt(str);
  125. while(num!=0) {
  126. remainder = num%10;
  127. num = parseInt(num/10);
  128. rev = rev * 10 + remainder;
  129. }
  130. alert("Reverse of "+str+" is "+rev);
  131. }
  132. </script>
  133. </body>
  134. </html>
  135.  
  136. --------------------------------------------------------------------------------------------------------------------------------------
  137.  
  138. 5
  139. <?xml-stylesheet type="text/css" href="6.css" ?>
  140. <!DOCTYPE HTML>
  141. <html>
  142. <head>
  143. <h1> STUDENTS DESCRIPTION </h1>
  144. </head>
  145. <students>
  146. <student>
  147. <USN>USN : 1CG15CS001</USN>
  148. <name>NAME : SANTHOS</name>
  149. <college>COLLEGE : CIT</college>
  150. <branch>BRANCH : Computer Science and Engineering</branch>
  151. <year>YEAR : 2015</year>
  152. <e-mail>E-Mail : santosh@gmail.com</e-mail>
  153. </student>
  154. <student>
  155. <USN>USN : 1CG15IS002</USN>
  156. <name>NAME : MANORANJAN</name>
  157. <college>COLLEGE : CITIT</college>
  158. <branch>BRANCH : Information Science and Engineering</branch>
  159. <year>YEAR : 2015</year>
  160. <e-mail>E-Mail : manoranjan@gmail.com</e-mail>
  161. </student>
  162. <student>
  163. <USN>USN : 1CG15EC101</USN>
  164. <name>NAME : CHETHAN</name>
  165. <college>COLLEGE : CITIT</college>
  166. <branch>BRANCH : Electronics and Communication Engineering
  167. </branch>
  168. <year>YEAR : 2015</year>
  169. <e-mail>E-Mail : chethan@gmail.com</e-mail>
  170. </student>
  171. </students>
  172. </html>
  173. 6.css
  174. student{
  175. display:block; margin-top:10px; color:Navy;
  176. }
  177. USN{
  178. display:block; margin-left:10px;font-size:14pt; color:Red;
  179. }
  180. name{
  181. WEB TECHNOLOGY LABORATORY WITH MINI PROJECT (15CSL77) 2018-19
  182. Dept. of CSE, CIT, Gubbi P a g e | 33
  183. display:block; margin-left:20px;font-size:14pt; color:Blue;
  184. }
  185. college{
  186. display:block; margin-left:20px;font-size:12pt; color:Maroon;
  187. }
  188. branch{
  189. display:block; margin-left:20px;font-size:12pt; color:Purple;
  190. }
  191. year{
  192. display:block; margin-left:20px;font-size:14pt; color:Green;
  193. }
  194. e-mail{
  195. display:block; margin-left:20px;font-size:12pt; color:Blue;
  196. }
  197.  
  198. --------------------------------------------------------------------------------------------------------------------------------------
  199.  
  200. 6
  201. <?php
  202. print "<h3> REFRESH PAGE </h3>";
  203. $name="counter.txt";
  204. $file = fopen($name,"r");
  205. $hits= fscanf($file,"%d");
  206. fclose($file);
  207. $hits[0]++;
  208. $file = fopen($name,"w");
  209. fprintf($file,"%d",$hits[0]);
  210. fclose($file);
  211. print "Total number of views: ".$hits[0];
  212. ?>
  213.  
  214. ---------------------------------------------------------------------------------------------------------------------------------------
  215.  
  216. 7
  217. <html>
  218. <head>
  219. <meta http-equiv="refresh" content="1"/>
  220. <style>
  221. p {
  222. color:white;
  223. font-size:90px;
  224. position: absolute;
  225. top: 50%;
  226. left: 50%;
  227. transform: translate(-50%, -50%);
  228. }
  229. body{background-color:black;}
  230. </style>
  231. <p> <?php echo date(" h: i : s A");?> </p>
  232. </head>
  233. </html>
  234.  
  235.  
  236. ---------------------------------------------------------------------------------------------------------------------------------------
  237.  
  238. 8 A
  239. <html>
  240. <head>
  241. <style>
  242. table, td, th
  243. {
  244. border: 1px solid black;
  245. width: 35%;
  246. text-align: center;
  247. background-color: DarkGray;
  248. }
  249. table { margin: auto; }
  250. input,p { text-align:right; }
  251. </style>
  252. </head>
  253. <body>
  254. <form method="post">
  255. <table>
  256. <caption><h2> SIMPLE CALCULATOR </h2></caption>>
  257. <tr><td>First Number:</td><td><input type="text" name="num1" /></td>
  258. <td rowspan="2"><input type="submit" name="submit"
  259. value="calculate"></td></tr>
  260. <tr><td>Second Number:</td><td><input type="text"
  261. name="num2"/></td></tr>
  262. </form>
  263. <?php
  264. if(isset($_POST['submit']))
  265. {
  266. $num1 = $_POST['num1'];
  267. $num2 = $_POST['num2'];
  268. if(is_numeric($num1) andis_numeric($num1) )
  269. {
  270. echo "<tr><td> Addition :</td><td><p>".($num1+$num2)."</p></td>";
  271. echo "<tr><td> Subtraction :</td><td><p> ".($num1-$num2)."</p></td>";
  272. echo "<tr><td> Multiplication :</td><td><p>".($num1*$num2)."</p></td>";
  273. echo "<tr><td>Division :</td><td><p> ".($num1/$num2)."</p></td>";
  274. echo "</table>";
  275. }
  276. else
  277. {
  278. echo"<script type='text/javascript' > alert(' ENTER VALID
  279. NUMBER');</script>";
  280. }
  281. }
  282. ?>
  283. </body>
  284. </html>
  285.  
  286. ---------------------------------------------------------------------------------------------------------------------------------------
  287.  
  288. 8 B
  289. <?php
  290. $a = array(array(1,2,3),array(4,5,6),array(7,8,9));
  291. $b = array(array(7,8,9),array(4,5,6),array(1,2,3));
  292. $m=count($a);
  293. $n=count($a[2]);
  294. $p=count($b);
  295. $q=count($b[2]);
  296. echo "the first matrix :"."<br/>";
  297. for ($row = 0; $row < $m; $row++) {
  298. for ($col = 0; $col < $n; $col++)
  299. echo " ".$a[$row][$col];
  300. echo "<br/>";
  301. }
  302. echo "the second matrix :"."<br/>";
  303. for ($row = 0; $row < $p; $row++) {
  304. for ($col = 0; $col < $q; $col++)
  305. echo " ".$b[$row][$col];
  306. echo "<br/>";
  307. }
  308. echo "the transpose for the first matrix is:"."<br/>";
  309. for ($row = 0; $row < $m; $row++) {
  310. for ($col = 0; $col < $n; $col++)
  311. echo " ".$a[$col][$row];
  312. echo "<br/>";
  313. }
  314. if(($m===$p) and ($n===$q)) {
  315. echo "the addition of matrices is:"."<br/>";
  316. for ($row = 0; $row < 3; $row++) {
  317. for ($col = 0; $col < 3; $col++)
  318. echo " ".$a[$row][$col]+$b[$row][$col]." ";
  319. echo "<br/>";
  320. }
  321. }
  322. if($n===$p){
  323. echo " The multiplication of matrices: <br/>";
  324. $result=array();
  325. for ($i=0; $i < $m; $i++) {
  326. for($j=0; $j < $q; $j++){
  327. $result[$i][$j] = 0;
  328. for($k=0; $k < $n; $k++)
  329. $result[$i][$j] += $a[$i][$k] * $b[$k][$j];
  330. }
  331. }
  332. for ($row = 0; $row < $m; $row++) {
  333. for ($col = 0; $col < $q; $col++)
  334. echo " ".$result[$row][$col];
  335. echo "<br/>";
  336. }
  337. }
  338. ?>
  339.  
  340. ---------------------------------------------------------------------------------------------------------------------------------------
  341.  
  342. 9
  343. <?php
  344. header('Content-Type: text/plain');
  345. $allTheStates = "Mississippi Alabama Texas Massachusetts Kansas";
  346. $statesArray = [];
  347. $states1 = explode(' ', $allTheStates);
  348. $i = 0;
  349. //states that ends in xas
  350. foreach ($states1 as $state) {
  351.  if (preg_match('/xas$/', ($state))) {
  352.  $statesArray[$i] = ($state);
  353.  $i = $i + 1;
  354.  print "\nThe States that ends in xas:" . $state;
  355.  }
  356. }
  357. //states that begins with k and ends in s
  358. foreach ($states1 as $state) {
  359.  if (preg_match('/^k.*s$/i', ($state))) {
  360.  $statesArray[$i] = ($state);
  361.  $i = $i + 1;
  362.  echo "\nThe states that begins with k ans ends in s:" . $state;
  363.  }
  364. }
  365. //states that begins with M and ends in s
  366. foreach($states1 as $state) {
  367. if (preg_match('/^M.*s$/', ($state))) {
  368.  $statesArray[$i] = ($state);
  369.  $i = $i + 1;
  370.  echo "\nThe states that begins with M and ends in s:" . $state;
  371. }
  372. }
  373. //states that ends in a
  374. foreach($states1 as $state) {
  375. if (preg_match('/a$/', ($state))) {
  376.  $statesArray[$i] = ($state);
  377.  $i = $i + 1;
  378.  echo "\nThe states that ends in a:" . $state;
  379. }
  380. }
  381. foreach ($statesArray as $element => $value) {
  382.  print( "\n" . $value . " is the element " . $element);
  383. }
  384. ?>
  385.  
  386. --------------------------------------------------------------------------------------------------------------------------------------
  387.  
  388. 10
  389. Goto Mysql and then type
  390. create database weblab;
  391. use weblab;
  392. create table student(usnvarchar(10),name varchar(20),address varchar(20));
  393. <html>
  394. <body>
  395. <style>
  396. table, td, th
  397. {
  398. border: 1px solid black;
  399. width: 33%;
  400. text-align: center;
  401. border-collapse:collapse;
  402. background-color:lightblue;
  403. }
  404. table { margin: auto; }
  405. </style>
  406. <?php
  407. $servername = "localhost";
  408. $username = "root";
  409. $password = "root";
  410. $dbname = "weblab";
  411. $a=[];
  412. // Create connection
  413. // Opens a new connection to the MySQL server
  414. $conn = mysqli_connect($servername, $username, $password, $dbname);
  415. // Check connection and return an error description from the last
  416. connection error, if any
  417. if ($conn->connect_error)
  418. die("Connection failed: " . $conn->connect_error);
  419. $sql = "SELECT * FROM student";
  420. // performs a query against the database
  421. $result = $conn->query($sql);
  422. echo "<br>";
  423. echo "<center> BEFORE SORTING </center>";
  424. echo "<table border='2'>";
  425. echo "<tr>";
  426. echo "<th>USN</th><th>NAME</th><th>Address</th></tr>";
  427. if ($result->num_rows> 0)
  428. {
  429. // output data of each row and fetches a result row as an
  430. associative array
  431. while($row = $result->fetch_assoc()){
  432. echo "<tr>";
  433. echo "<td>". $row["usn"]."</td>";
  434. echo "<td>". $row["name"]."</td>";
  435. echo "<td>". $row["addr"]."</td></tr>";
  436. array_push($a,$row["usn"]);
  437. }
  438. }
  439. else
  440. echo "Table is Empty";
  441. echo "</table>";
  442. $n=count($a);
  443. $b=$a;
  444. for ( $i = 0 ; $i< ($n - 1) ; $i++ )
  445. {
  446. $pos= $i;
  447. for ( $j = $i + 1 ; $j < $n ; $j++ ) {
  448. if ( $a[$pos] > $a[$j] )
  449. $pos= $j;
  450. }
  451. if ( $pos!= $i ) {
  452. $temp=$a[$i];
  453. $a[$i] = $a[$pos];
  454. $a[$pos] = $temp;
  455. }
  456. }
  457. $c=[];
  458. $d=[];
  459. $result = $conn->query($sql);
  460. if ($result->num_rows> 0)// output data of each row
  461. {
  462. while($row = $result->fetch_assoc()) {
  463. for($i=0;$i<$n;$i++) {
  464. if($row["usn"]== $a[$i]) {
  465. $c[$i]=$row["name"];
  466. $d[$i]=$row["addr"];
  467. }
  468. }
  469. }
  470. }
  471. echo "<br>";
  472. echo "<center> AFTER SORTING <center>";
  473. echo "<table border='2'>";
  474. echo "<tr>";
  475. echo "<th>USN</th><th>NAME</th><th>Address</th></tr>";
  476. for($i=0;$i<$n;$i++) {
  477. echo "<tr>";
  478. echo "<td>". $a[$i]."</td>";
  479. echo "<td>". $c[$i]."</td>";
  480. echo "<td>". $d[$i]."</td></tr>";
  481. }
  482. echo "</table>";
  483. $conn->close();
  484. ?>
  485. </body>
  486. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top