Posts

Showing posts with the label web

My First webpage using Bootstrap Framework

Image
In this post you will learn to create your first webpage using Bootstrap Framework. Bootstrap framework is a responsive framework. It automatically adjust the site's layout according to the device in which it is viewed. Responsiveness is given highest priority now a days. This webpage using Bootstrap Framework uses basic components. Designing webpage using Bootstrap Framework is easy and need to less few lines of code. Components used Containers Jumbotron Well Panels You can view the demo of the  webpage using Bootstrap Framework by clicking here . The Code <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> <div class="container"> <div class="jumbotron"> <h1>Page Title</h1> <h4>This is my first webpage in Bootstrap</h4> </div> </div> <div class="container"> <div class="row"> <div...

Insert Data in MySQL DB using PHP

Image
This is a simple post in php. In this post you will learn how to add data to the MySQL Database. Basically in this post, a form is used which accepts input from the user. A class DBClass is used for interactions with the database. Screenshot The Code The Config.php File <?php define("DB_NAME","sample");//Database Name define("DB_USER","root");//Database User define("DB_PASS","");//Database Password define("DB_HOST","localhost");//Database Host ?> The DBClass.php file <?php require_once 'config.php'; class DBClass { public function addData($table,$name,$phone,$email) { $con=mysqli_connect(DB_HOST,DB_USER,DB_PASS,DB_NAME); $res=mysqli_query($con,"insert into $table values ('$name','$phone','$email')"); if($res) { echo '<script>alert("Data Succesfully inserted !")</script>'; } else { echo '...

Create a HTTP server using Node.js and Express

Image
This is a simple post which will create a web page containing a header and a paragraph. The basic motto of this post is to demonstrate the use of Express with Node.js . At the end of the post you will learn how to create static html pages using Node.js and express. Screenshot The Code var express = require('express'); var app = express(); app.get('/', function (req, res) { res.send('<div style="padding:100 100 100 100; text-align=center; width:650px;">'+ '<h1 style="border-bottom-width: 2px;border-bottom-style: solid;">'+ 'This is a Sample Heading</h1><p>This is a sample Paragraph bellow the Header'+ '<br/>This is a simple Node Js and Express implementation.</p>'+ '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. '+ 'Nam in interdum felis. Duis rhoncus erat nunc, ut ultricies dolor fringilla'+ ' vel. Donec ac suscipit mi. S...

jQuery Show and Hide Implementation

Image
This is a simple post in which you will learn how to implement show and hide functions in jQuery. Basically in this post you will learn how to hide html elements using jQuery show and hide Methods. Demo jQuery HIDE & SHOW Hide Show The Code: <script> $(document).ready(function(){ $("button#bDemo1").click(function(){ $("div#divDemo").hide(1000) }); $("button#bDemo2").click(function(){ $("div#divDemo").show(1000) }); }); </script> <style> #bDemo1 #bDemo2{ color: #fff !important; background-color: #2196F3 !important; } #divDemo{ border:1px solid #555; border-radius:3px; color:white; background:#555; height:270px; width:400px; position:relative; font-size:5em; } </style> <div id="divDemo">jQuery HIDE & SHOW</div></br> <button id="bDemo1">Hide</button> <button id="bDemo2">Show</button> Got anything to s...

Display Time using Js and Css3

Image
This is a sample post in which you can create a Java script which can display the current time. Basically it fetches the local time from the system every 1 second using setInterval method. Things we have used : Css3 shadows and Hover Properties Date Class with toLocaleTimeString() method setInterval() method. Demo: As you can see when you hover the mouse over it, the color changes. This affect is added using css3. The Code: <html> <style> body { background-color:black; } #time{ display: inline-block; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; padding: 10px; border: none; font: normal 48px/normal "Warnes", Helvetica, sans-serif; color: rgba(255,255,255,1); text-decoration: normal; text-align: center; -o-text-overflow: clip; text-overflow: clip; white-space: pre; text-shadow: 0 0 10px rgba(255,255,255,1) , 0 0 20px rgba(255,255,255,1) , 0 0 30px rgba(255,255,255,1) , 0...

Simple animation using jQuery

Image
This is a post in which the demonstration of various types of animations in jQuery is shown. In this, when the button is clicked, the div scales it self then inside the div, the font also scales it's size. Demo Start Animation jQuery Animation The Code <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(document).ready(function(){ $("button#bDemo").click(function(){ $("div#divDemo").animate({left:"170px",height:"190px",width:"400px",opacity:"0.5"},"slow"); $("div#divDemo").animate({fontSize:"5em"},"slow"); }); }); </script> <style> #bDemo{ color: #fff !important; background-color: #2196F3 !important; } #divDemo{ border:1px solid #555; border-radius:3px; color:white; background:#555; height:20px; width:120px; position:relative; } </style> <button id=...

Simple equation solver in JS

Image
This post will let you create a simple equation solver. This program is designed using JS and HTML. This equation solver can be used to solve addition, division, subtraction or multiplication between two numbers. Screenshot Things this code will do Create a Form Take Input from the user A button when click, calls a function Function determines which type of operation and appends the Answer. The Code <!--The CSS For the Page--> <style> #ans { position: relative; text-align: center; top: 200; } .form { position: relative; text-align: -webkit-center; padding: 110; } .form input[type="text"] { padding: 10 10 2 10; border-bottom: 2px; border-style: solid; border-left: none; border-top: none; border-right: none; } .form input:focus,button:focus{ outline: 0; } .form button { padding: 2; background-color: white; border-bottom-color: black; border-style: solid; border-left: none; border-right:...

Getting Form Data through Java Script

Image
This is a simple code snippet in which you will be able to retrieve data from the form using JS. This is a basic Js stuff, which you should know how to use. Basically in this code snippet, there in a HTML form element which has 2 text type input box and a button which calls the JS function. Screenshot The JS Function has a Form Element which takes the values from the input elements and then appends it inside a paragraph and shows ! The Code <!--The CSS For the Page--> <style> #pclass { position: relative; text-align: center; top: 300; } .form { position: relative; text-align: -webkit-center; padding: 110; } .form input[type="text"] { padding: 10 10 2 10; border-bottom: 2px; border-style: solid; border-left: none; border-top: none; border-right: none; } .form button { padding: 5; background-color: white; border-left: none; border-right: none; border-top: none } </style> <!--The CSS Ends--...

QRCode Generator In PHP

Image
This post will guide you to create your own QR code Generator. Basically we will use Google's API to generate the QR code. QR code is a machine-readable code consisting of an array of black and white squares, typically used for storing URLs or other information for reading by the camera on a smartphone. Screenshots[Demo] Home page of the script showing which takes the Input. Generated QR code of the input Given The Code <div style="text-align:center;"> <form class="email" name="qrc" method="post" action="<?php $_PHP_SELF ?>" id='12'> <p align="center"><font color=#99742e><span style="font-size:12pt;"><b>Link</b></span></font></p> <input type="text" name="qrlink" autocomplete="off" placeholder="Enter The Link"><br/> <input class="send" type="submit...

Read Input form HTML Form Element using JS

Image
This post will help you to fetch the value from any input tag in the FORM Element. The below code fetches the value of the text field when submit button is clicked and displays an JS alert counting the number of characters of the input string. Screenshots: The Code: <script type="text/javascript"> function callMe() { var nam=document.getElementById("myText").value; alert("Your name is "+nam+" and it has "+nam.length+" Chars"); } </script> <form onsubmit="callMe()"> <input type="text" placeholder="Enter your name!" id="myText"/><br/><br/> <input type="submit" value="Submit"> </form> Found any suggestions ? Comment them here !

How to add music or video to web page

Image
Adding music/video to Web Page   Music / video can be added to a web page by simply using <embed> html tag. This tag indicates the browser   to include controls for the multimedia which automatically provides browser supports as soon as   <embed> tag is encountered . Some of the attributes which can be used with <embed> tag are as follows: Attribute Name Function align Determines how to align the object. It can be set to either center, left or right. autostart This boolean attribute indicates if the media should start automatically. You can set it either true or false. loop Specifies if the sound should be played continuously (set loop to true), a certain number of times (a positive value) or not at all (false) playcount Specifies the number of times to play the sound. This is alternate option for loop if you are using IE....

Simple Password Generator Using JS

Image
This is a simple password generator using javascript. This script generates random passwords of length 6. These code snippet can be used for those registration systems where user is assigned with an generated password for the first time. This password is based on 6 String sets which shuffle their index and generate a password ! Screenshots[Demo]: The Code: <script> function gene() { var set1='abcdefghi0',set2='jklmnopqu2',set3='ABCDEFG34s'; var set4='HIJtuv569w',set5='xJKL!@#$7',set6='8&_MNOPQRS'; var set7='TUVWXYZ012'; var pas=set1.charAt(Math.floor((Math.random() * 10) + 1))+ set2.charAt(Math.floor((Math.random() * 10) + 1))+ set3.charAt(Math.floor((Math.random() * 10) + 1))+ set4.charAt(Math.floor((Math.random() * 10) + 1))+ set5.charAt(Math.floor((Math.random() * 10) + 1))+ set6.charAt(Math.floor((Math.random() * 10) + 1))+ set7.charAt(Math.floor((Math.random() * 10) + 1)); prompt(...

Image Rotation When Mouse Hovered Using CSS3

Image
This post is all about a simple code snippet using the combination of the CSS3 and HTML which rotates an image at a certain degree when mouse is hovered on it ! This add-on piece of code make your web-page look more trendy. Screenshots[Demo] :   The complete code is divided into two parts, the css and the HTML The CSS part: .hovrot { -webkit-transition: all 0.5s ease; -moz-transition: all 0.5s ease; -o-transition: all 0.5s ease; -ms-transition: all 0.5s ease; transition: all 0.5s ease; border-width: 2px; border-color: #594c2d; border-style: double; height:200px; width:200px; } .hovrot:hover { -webkit-transform: rotate(25deg); -moz-transform: rotate(25deg); -o-transform: rotate(25deg); -ms-transform: rotate(25deg); transform: rotate(25deg); color: #000000; } The HTML part: <img src="img.jpg" class='hovrot' alt='This is a simple Image'/> <b style="position: r...

Copy To Clipboard Using JavaScript With No Flash

Image
This code snippet will create a button which on clicked will open prompt on the web browser using which you can copy the given value to the function. This is a simple implementation of JavaScript Prompt(). You can now from the prompt copy the passed data simply by pressing ctrl+c from your keyboard. This code snippet can be used in php for passing dynamic data to the function which can be displayed in the prompt so that copying is easy. From the Web you can find a lot many ways to directly copy from clipboard but those use flash. This code snipped dont use any flash content ! Screenshots: This Java Script code snippet working with PHP files This Java Script code snippet working with HTML files The Code Snippet: <script> function ctc(user,pass) { window.prompt("Copy to clipboard: Ctrl+C, Enter", "username: "+user+", password: "+pass); } </script> <button name="test" value="click" onClick=ctc(...

Create a Lightweight Blogging System Using PHP and MYSQL

Image
This post will help you to create your very own lightweight blogging system. This system is completely created by using PHP and mysql. This system consists of 4 files namely admin.php, index.php, art.php and .htaccess. We will go through each files deeply. This time on we have used automatic setup system which will automatically create database and tables. In this system we have created a database article and table article . Lets see the screens of various pages: The homepage of the Blogging system showing the titles of the posts. When clicked on any post, the page of the blogging system The admin control panel of the blogging system where the admin can add new articles Lets go through various sections of this blogging system Lets create the index.php file // A function to initiate automatic setup of database and tables function setup() { echo(' <p style="color: #008000; text-align: left; font-size: 15pt;"">-Automatic setup is starte...

Create a simple chatroom system in php without databases

Image
In this post, you will be guided to create a simple chatroom system in php without any databases. This system will create a folder for each chatroom and will store data in a simple .txt file, which is later accessed from the server side to display the conversations in the chatroom. This chatroom is flexible and light weight, it automatically reloads itself in 10 seconds so that new information is fetched correctly. The complete system is based on just a single php file in which file handling is used to retrieve and store the conversations from the chatroom. Demo: The index page when you start a coversation The conversation section of the index page Lets have some look on the major sections of the code To ask details when someone visits the page for the first time if (isset($_GET['enSubmit']) && isset($_GET['uname']) && isset($_GET['rname'])){ echo'<meta http-equiv="refresh" content="10">'; ...

Create a Twitter Tweets like publishing system

Image
This post guides you to create your own Twitter. Well that's not completely true but this post will guide you to create a Twitter Tweets like publishing System. Using this system, your users can register and sign in to their profiles and can update their tweets just like in twitter. This system is just designed to show the user who tweeted and at what time. You can add extra functionalities.  The complete system is based of PHP and MYSQL and a lot of CSS styles. This system contains mainly 3 files, firstly the config.php , secondly the index.php and lastly the profile.php . After uploading the files to your web server, first edit the details of the config.php file, namely the database user,name and password. The run in on the web browser, just like http://www.xyz.com/config.php now you are just good to go. Your users can access the system by just going to your url. i.e. http://www.xyz.com/. Demo The Home Page of the system where user can login The Profile page o...

Create a simple user profile system

Image
This post guides you to create you own simple user profile system. Using this system, your users can register and sign in. The complete system is based of PHP and MYSQL.  This system contains mainly 3 files, firstly the config.php , secondly the index.php and lastly the profile.php.  After uploading the files to your web server, first edit the details of the config.php file, namely the database user,name and password . The run in on the web browser, just like http://www.xyz.com/config.php/ now you are just good to go. Your users can access the system by just going to your url. i.e. http://www.xyz.com/. Demo The Homepage of the System, showing both sign in and sign up buttons. The Profile Page of the System, Showing the username and the last login details. PHPMyAdmin panel showing the data entered in the database. Lets Create the config.php file. <?php $dbhost = 'localhost';// Database Host. $dbuser = 'sid';// Database User. $dbpas...

Create a simple password authentication for HTML page

Image
In this post, you can create a simple password authentication system using php using which you can protect you sensitive information. Basically the complete authentication system is based on a single php file. In this file, you need to store the username and the password, which you need to enter in order to login to view you secured data. The complete page is overlayed by a div which when entered the correct credentials, disappears so that you can see the secured content. Demo The Layout When The Page Is Opened. The Layout When Incorrect Credentials are Entered. The Secured Content Displayed When Correct Credentials Entered. The Content of the PHP file <html> <head> <style> #mask{ background-color: aliceblue; overflow: overlay; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 9000; } #mask_lay { position:absolute; background-color: cornsilk; top:200px; left:40%; width :200px; height:110px; z-i...