php之jquery

<!DOCTYPE html>

<html>

<head>

<script type="xxx.js"></script>

<script>

 function myFunciton(){

$("#demo").html("hello jquery")

$("#a").attr("style","color:red").html("hello")

$(document).ready(myFunction);

}

</script>

</head>

<body>

<h1 id="demo"></h1>

<h1 id="a"></h1>

</body>

</html>

function myFunction()

{

    var obj="document.getElementById("demo");

    obj.innerHTML="Hello prorotype";

}

onload=myFunction;

function myFunction()

{

 $("#demo").insert("hello prototype");

}

Event.observe(window,"load",myFunction);

observe  receive three parameter

1.which HTML you would like to handle

2.which event you want to do

3.which function you would like to handle

function myFunction()

{

   $("#demo").insert("hello boys");

}

   Event.observe(windows,"load",myfunction);

prototype eg:

<!DOCTYPE html>

<html>

<head>

<script src="xxx.js"></script>

<script>

function myFunction()

{

$("#demo").writeAttribute("style","color:red").insert("hello protorype")

}

Event.observe(windows,"load",myFunction);

</script>

</head>

<body>

<h1 id="demo"></h1>

</body>

</html>

原文地址:https://www.cnblogs.com/teyues/p/5732032.html