Learn HTML

Learn HTML With HTML you can create your own Web site. This tutorial teaches you everything about HTML. HTML is easy to learn - You will enjoy it.

21/10/2025

Join Future minds.

01/09/2020

EXCERCISE 1
TRY THIS



Page Title


My First Heading
My first paragraph.
HELLO...WELCOME TO LEARN HTML
LEARN HTML-Welcome Page



My Bonnie lies over the ocean.

My Bonnie lies over the sea.

My Bonnie lies over the ocean.

Oh, bring back my Bonnie to me.

I am normal
I am red
I am blue
I am big

14/07/2020
BEST SOFTWARE FOR TEACHERSsTEPS RECORDER
31/01/2018

BEST SOFTWARE FOR TEACHERS
sTEPS RECORDER

It just records all the tasks that we perform on the machine and make word document with pictures too.....excellant

https://youtu.be/JxyY39i7Gxs......AMAZING SOFTWARE.....WOW.....
27/01/2018

https://youtu.be/JxyY39i7Gxs......

AMAZING SOFTWARE.....WOW.....

It just records all the tasks that we perform on the machine and make word document with pictures too.....excellant

25/04/2016

Learn c and C++ thrrough whtsup is a Whtsup group
devoted to teaching
you how to program in C++. Whether you’ve had any
prior programming experience or not, the tutorials on
this group will walk you through all the steps to write,
compile, and debug your C++ programs, al with
plenty of examples, discussions, audio files, video files,
animations.
Becoming an expert won’t happen overnight, but with
a little patience, you’ll get there. And Learn c and c++
through Whtsup group show you the way...All the best

25/04/2016

Learn C++ with in 10 days through Whtsup....it is so
easy to learn wth few steps.Any body can join....visit
Learn C and C Plus Plus Throughwhtsup page for
details.....its for free plz pass this msg to alll

09/05/2013

chapter 3

HTML5 Drag and Drop

Drag and Drop

Drag and drop is a very common feature. It is when you "grab" an object and drag it to a different location.

In HTML5, drag and drop is part of the standard, and any element can be draggable.
Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support drag and drop.

Note: Drag and drop does not work in Safari 5.1.2.
HTML5 Drag and Drop Example

The example below is a simple drag and drop example:
Example




function allowDrop(ev)
{
ev.preventDefault();
}

function drag(ev)
{
ev.dataTransfer.setData("Text",ev.target.id);
}

function drop(ev)
{
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}











Try it yourself »

It might seem complicated, but lets go through all the different parts of a drag and drop event.
Make an Element Draggable

First of all: To make an element draggable, set the draggable attribute to true:


What to Drag - ondragstart and setData()

Then, specify what should happen when the element is dragged.

In the example above, the ondragstart attribute calls a function, drag(event), that specifies what data to be dragged.

The dataTransfer.setData() method sets the data type and the value of the dragged data:
function drag(ev)
{
ev.dataTransfer.setData("Text",ev.target.id);
}

In this case, the data type is "Text" and the value is the id of the draggable element ("drag1").
Where to Drop - ondragover

The ondragover event specifies where the dragged data can be dropped.

By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element.

This is done by calling the event.preventDefault() method for the ondragover event:
event.preventDefault()

Do the Drop - ondrop

When the dragged data is dropped, a drop event occurs.

In the example above, the ondrop attribute calls a function, drop(event):
function drop(ev)
{
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}

Code explained:

Call preventDefault() to prevent the browser default handling of the data (default is open as link on drop)
Get the dragged data with the dataTransfer.getData("Text") method. This method will return any data that was set to the same type in the setData() method
The dragged data is the id of the dragged element ("drag1")
Append the dragged element into the drop element

Examples
More Examples

Drag image back and forth
How to drag (and drop) an image back and forth between two elements.

All THE BEST
HAFZAL RAHMAN

Address

Chittur
678503

Website

Alerts

Be the first to know and let us send you an email when Learn HTML posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Shortcuts

Share

Category