- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 448 Articles for Programming Scripts
172 Views
JSRadial gradient with matrix is created in the following way. You can try to run the following way to create JS Radial gradient with matrix −var canvas1 = document.getElementById("canvas"); //canvas1 variable to identify given canvas var ctx1 = canvas.getContext("2d"); //This is used to tell context is 2D var gradient1 = ctx1.createRadialGradient(100/horizontalScale, 100/verticalScale, 100, 100/horizontalScale, 100/verticalScale, 0); //This will create gradient with given canvas context gradient1.addColorStop(1, "green"); //New color green is added to gradient gradient1.addColorStop(0, "red"); //New color red is added to gradient ctx1.scale(horizontalScale, verticalScale); //Context matrix ctx1 is shrinked according to horizaontal and vertical scale ... Read More
3K+ Views
The date-time format can be changed by using custom HTML5 elements. If we wish to change or override existing Html tags then we can do so with the help of shadow DOM.We can make customizable tags like −Here is an example −However, E10 and older versions do not support customizable tags; however, all newer versions support customizable tags.
167 Views
Align list-item with the help of flex. Flex will make columns flexible according to content. The wrapper will layout columns in a row..wrap{ display : flex }// This will help wrapper to become flexible .wrap.col{ flex: 1 0 33%; }Flex is basically a property which helps in making element flexible.Use the following to keep the lists vertically aligned to the bottom −.col .content { margin-top: auto; }
5K+ Views
DIV content can be saved as an image with the help of html2canvas() function in JavaScript. DIV tag defines a section in HTML document.Example Welcome This shows the division area named cpimg.The html2canvas() function save div as an image with the following code −html2canvas(document.querySelector(“#cpimg”)).then(canvas { document.body.appendChild(canvas) });It saves the referred div section “cpimg” into the image.
2K+ Views
A Canvas is just a rectangular area on the HTML page. We can draw graphics in this rectangular area (Canvas) with the help of JavaScript. Canvas can be created in HTML5 as − This creates an empty canvas with name canvas1 with width=200 and height=100. To draw graphics in it, we use JavaScript −var canvas = document.getElementById("Canvas1"); var ctx1 = canvas.getContext("2d"); ctx1.moveTo(0, 0); ctx1.lineTo(300, 200); ctx1.stroke(); // This method actually draw graphics as per context object To save this graphic, we need ... Read More
184 Views
Meta tags are used to store data about HTML documents such as who wrote it and the description of the document.The best solution is to define default tags in the application and overwrite default parameters in view. We can do so in PHP.Making changes in config file first −
256 Views
HTML5 allows us to interact with local client files (local client files are the files that are locally stored in the user’s computer). This is possible because HTML5 provides powerful APIs (Application Programming Interfaces) which are the interfaces with the help of which binary data and user’s local file system can be accessed. With the help of these file APIs, web applications can read files, file directory, can drag and drop from desktop to browser.The following are the APIs that are used to access local client files −File System APIFile APIFile Writer APIThe following are some examples −With the help ... Read More
388 Views
Use the accept attribute to set the types of files that the server accepts in HTML. Use the attribute only with .ExampleYou can try to run the following code to work with the accept attribute: File Upload Box The capture attribute is a boolean attribute that, if specified, indicates that the capture of media directly from the device...is preferred.The capture attribute is NOT used to include the camera option in the dialog but to indicate that direct capture from the webcam is preferred. The "correct" code is given below
249 Views
The Web Audio API is used to control audio, which allows you to choose audio sources. You can also add effects; create audio visualizations, panning, etc.ExampleYou can try to run the following code snippet to generate sound −// use one context per document. Here we are creating one context for one document. You can create for other documents also var context = new (window.AudioContext || window.webkitAudioContext)(); // oscillator var os = context.createOscillator(); os.type = 'sine'; // sine is the default. So you can also use square, saw tooth, triangle os.frequency.value = 500; // setting the frequency Hz os.connect(context.destination); ... Read More
362 Views
Add a button to play or pause the video. Then we have styled the video to a hundred percentage height and width so that it covers the entire background.The following is the code snippet to set video as a site background in HTML5. Your browser does not support HTML5 video. The following is to pause the video −function display() { if (video.paused) { video.play(); btn.innerHTML = "Pause the video!"; } else { video.pause(); btn.innerHTML = "Play"; } }