JavaScript - Test Prototype

Reference Prototype

To test a JavaScript library, you need to reference it in your web page.

To reference a library, use the





Prototype Description

Prototype provides functions that make HTML DOM programming easier.

Similar to jQuery, Prototype also has its own $() function. The

$() function accepts the id value of an HTML DOM element (or DOM element) and adds new functionality to the DOM object.

Unlike jQuery, Prototype does not have a ready() method to replace window.onload(). Instead, Prototype adds extensions to the browser and the HTML DOM.

JavaScript method:

function myFunction()
{
var obj=document.getElementById("h01");
obj.innerHTML="Hello Prototype";
}
onload=myFunction;

Prototype method:

function myFunction()
{
$("h01 ").insert("Hello Prototype!");
}
Event.observe(window,"load",myFunction);


Event.observe() accepts three parameters:

The HTML DOM or BOM (Browser Object Model) object you wish to process

The event you wish to process

You wish to Called function


Instance comparison:

    php中文网(php.cn)   

Comparison:

    php中文网(php.cn)   


Continuing Learning
||
php中文网(php.cn)

请在浏览器中打开 F12 观察结果

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!