Posts

Showing posts with the label HTML

Multiple files upload (Array) with CodeIgniter

view: <input type="file" class="form-control" name="userfile[]" multiple> controller: function insertuser() {          $this->load->library('upload');     $files = $_FILES;     $cpt = count($_FILES['userfile']['name']);     for($i=0; $i<$cpt; $i++)     {                  $_FILES['userfile']['name']= $files['userfile']['name'][$i];         $_FILES['userfile']['type']= $files['userfile']['type'][$i];         $_FILES['userfile']['tmp_name']= $files['userfile']['tmp_name'][$i];         $_FILES['userfile']['error']= $files['userfile']['error'][$i];         $_FILES['userfile']['size']= $files['userfile']['size'][$i];          $this->upload->initialize($this->set_upload_options());         $uploadimages=$this->upload->do

live sum using javascript

<script type="text/javascript"> $(document).ready(function() {     //this calculates values automatically     sum();     $("#num1, #num2").on("keydown keyup", function() {         sum();     }); }); function sum() {             var num1 = document.getElementById('num1').value;             var num2 = document.getElementById('num2').value; var result = parseInt(num1) + parseInt(num2); var result1 = parseInt(num2) - parseInt(num1);             if (!isNaN(result)) {                 document.getElementById('sum').value = result; document.getElementById('subt').value = result1;             }         } </script> <form name="form1" method="post" action="" > <table> <tr><td>Num 1:</td><td><input type="text" name="num1" id="num1" /></td></tr> &

add more button new row using javascript

<!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> <!-- jQuery library --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <!-- Latest compiled JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> <script>$(document).ready(function () { var counter = 0; $("#addrow").on("click", function () { var newRow = $("<tr>"); var cols = ""; cols += '<td><input type="text" class="form-control" name="name' + counter + '"/></td>'; cols += '<td><input type="text" class="form-control"

OOPS Concepts in PHP?

Class  − This is a programmer-defined data type, which includes local functions as well as local data. You can think of a class as a template for making many instances of the same kind (or class) of object. Object  − An individual instance of the data structure defined by a class. You define a class once and then make many objects that belong to it. Objects are also known as instance. Member Variable  − These are the variables defined inside a class. This data will be invisible to the outside of the class and can be accessed via member functions. These variables are called attribute of the object once an object is created. Member function  − These are the function defined inside a class and are used to access object data. Inheritance  − When a class is defined by inheriting existing function of a parent class then it is called inheritance. Here child class will inherit all or few member functions and variables of a parent class. Parent class  − A class that is inherited from b

Google places autocomplete dropdown

The Google Places API Web Service enforces a default limit of 1 000 requests per 24 hour period, which you can increase free of charge. If your app exceeds the limit, the app will start failing. Verify your identity to get up to 150 000 requests per 24 hour period <!DOCTYPE html> <html>     <head>         <title>Place Autocomplete</title>         <meta name="viewport" content="initial-scale=1.0, user-scalable=no">         <meta charset="utf-8">         <script src="http://code.jquery.com/jquery-latest.min.js"></script>         <script>             $(document).ready(function() {                 $('input.deletable').wrap('<span class="deleteicon" />').after($('<span/>').click(function() {                     $(this).prev('input').val('').trigger('change').focus();                 }));             });         </scr

Introduction of JavaScript

JavaScript is the programming language of HTML and the Web. JavaScript is easy to learn. This tutorial will teach you JavaScript from basic to advanced. JavaScript Can Change HTML Content One of many JavaScript HTML methods is   getElementById() . example: <!DOCTYPE html> <html> <body> <h1>What Can JavaScript Do?</h1> <p id="demo">JavaScript can change HTML content.</p> <button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button> </body> </html>

javascript in html

To insert a JavaScript script in an HTML page, you use the   <script> ... </script>   tag.   Don't forget the closing </script> tag!   Now get ready to fire off your text editor of choice and let's get coding! Let's start with a basic HTML page, like this one: <!DOCTYPE html> <html> <head> <title>My first JavaScript page</title> </head> <body> </body> </html> The JavaScript script is inserted either in the HTML page itself or in a separate file. Embed JavaScript in the HTML page The <script> tag and its   type   attribute tell the browser: "Hey, browser! There's a script coming up, and it's a JavaScript script." You can do this either in the <head> section, as follows: <!DOCTYPE html> <html> <head> <title>My first JavaScript page</title> <script type="text/ja

Events in Javascript

What are events? Events   are occurrences taking place in the context of the   interactions   between   web server ,   web browser , and   web user . onClick   event: triggered by you as you click the link; onUnload   event: triggered by the web browser as it leaves the current web page; onLoad   event: triggered by the browser as the new web page content is loaded. Which events should I focus on from a JavaScript point of view? It all depends on the JavaScript program you're writing, that is, on the objectives you want to achieve with your script. However, the most common events you're likely to deal with in your JavaScript are: onLoad/onUnload ; onClick ; onSubmit   (triggered by the user submitting a form); onFocus / onBlur   (triggered by a user as, for example, she clicks in a textbox or clicks away from a textbox respectively); onMouseOver / onMouseOut   (triggered by the user moving the mouse over or away from an HTML element respectively). There are other events that mi

Variables and Constants in javascript

Variables   and   constants   are like containers where you store data and values for processing in JavaScript. The difference between a   variable   and a   constant   is this: once you give a   value   to a   constant the value is meant to be kept unchanged   throughout the script. In all circumstances where you reasonably foresee that the   original value is modified   through the script, by all means use a   variable   as your storage room. In fact,   you're going to use variables most of the times . In this lesson, you're going to learn: how to   create   variables and constants; how to   assign   values to variables and constants; how to   use   variables in your code; how to   name   variables and constants correctly. How to create variables and constants You   declare , that is, create variables and constants in a similar way. Here's how you   declare a variable : /*To declare a variable you give it a name preceded by the JavaScrip