Found 448 Articles for Programming Scripts

HTML5 Canvas distorted

Chandu yadav
Updated on 16-Dec-2021 12:28:24

499 Views

If the canvas looks distorted, then try to change the height and width −The default height and width of the canvas in HTML5 is of 2/1 ratio −width = 300 height = 150ExampleLet us see an example −                    #mycanvas{border:1px solid red;}                         Output

Passing mouse clicks through an overlaying HTML element

Ankith Reddy
Updated on 25-Jun-2020 07:05:20

724 Views

Retrieve the mouse coordinates in the click event. Now, retrieve the element by hiding your overlay, and use the following. After that, redisplay the overlay −document.elementFromPoint(x, y)You can also use the following CSS −div {    pointer-events:none; }

HTML5 Input type “number” in Firefox

karthikeya Boyini
Updated on 04-Jun-2020 09:35:44

624 Views

The min attribute of the input type number isn’t supported by Firefox, but it works correctly in Google Chrome.ExampleLet us see an example −           HTML input number                        Mention any number between 1 to 10                              

Make HTML5 Canvas fill the whole page

Chandu yadav
Updated on 27-Jan-2020 08:06:38

2K+ Views

To make canvas fill the whole page, you need to be 100% in width and height of the page.* {    margin: 0;    padding: 0; } body, html {    height:100%; } #canvas {    position:absolute;    height:100%; width:100%; }

Render ASP.NET TextBox as HTML5 Input type “Number”

karthikeya Boyini
Updated on 25-Jun-2020 06:07:18

979 Views

To render ASP.NET TextBox as HTML5 input type “Number”, set type="number" directly on the textbox.Let us see an example of ASP.NET TextBox −You can also use the following dynamically created the control −TextBox tb = new TextBox(); tb.Attributes.Add("Type", "number");

Flexbox and vertical scroll in a full-height app using newer Flexbox API with HTML

Chandu yadav
Updated on 24-Jun-2020 14:16:04

443 Views

The flex property is a shorthand for the flex-grow, flex-shrink, and flex-basis properties. The flex property sets the flexible length on flexible items.For example −#container article {    -webkit-flex: 1 1 auto;    overflow-y: auto;    height: 0px; /*here the height is set to 0px*/ }If you want a min-height, the use height: 100px; that it is exactly the same as − min-height: 100px;#container article {    -webkit-flex: 1 1 auto;    overflow-y: auto;    height: 100px; /*here the height is set to 100px*/ }

The correct way to work with HTML5 checkbox

Giri Raju
Updated on 24-Jun-2020 14:16:39

141 Views

The following is the correct way −ExampleHere is an example −           Checkbox Control                         Maths           Physics            

HTML5 Cross Browser iframe post message - child to parent?

George John
Updated on 24-Jan-2020 11:25:46

144 Views

The parent object provides a reference to the main window from the child.The following is the parent code. The directive below triggers the iFrame to send a message to the parent window every 3 seconds. No initial message from the main window needed!var a= window.addEventListener ? "addEventListener" : "attachEvent";// here a is the event method var b= window[a];// here b is the eventer var c= a== "attachEvent" ? "onmessage" : "message";// here c is the message event // Listen to message from child window b (c, function(e) {    var d= e.message ? "message" : "data";// here d is ... Read More

Upload from local drive to local filesystem in HTML with Filesystem API

vanithasree
Updated on 24-Jun-2020 14:09:06

154 Views

To upload from local drive to the local file system, we can use −Webkitdirectory attribute on − This allows the user to select a directory by the appropriate dialog box.Filesystem API is a sandboxed filesystem, which allows us to store files on client’s machine.File API allows us to read files. Files are accessible by elementAll of the above is working fine in Google Chrome.WebKit directory is a much better option among these. Use the following for directory −webkitRequestFileSystem(    window.TEMPORARY, 5 * 1024 * 1024, function(_fs) {       fs = _fs;    }, ErrAbove, err and fs are −var fs, err = function(err) {    throw err; };

Mouse event not being triggered on HTML5 canvas? How to solve it?

Arjun Thakur
Updated on 24-Jun-2020 14:09:51

357 Views

To trigger mouse event we can add −-webkit-transform: translate3d(0, 0, 0)In addition to this canvas can also be styled.Another way is to add a listener in the event mousemove,canvas.addEventListener("mousemove", this.checkMouseLocation.bind(this, this.inputs), false);By adding this listener, we can easily trigger a mouse move event in HTML5.

Advertisements