JavaScript DHTML/HTML/Script

Материал из Web эксперт
Перейти к: навигация, поиск

"event" Example

   <source lang="html4strict">
   

<html> <body> <script id="myScript" for="myButton" event="onclick()">

   alert(myScript.event);

</script> <button id="myButton">Event for This Script</button> </body> </html>


     </source>
   
  


Script "defer" Example

   <source lang="html4strict">
   

<html> <body> <script language="javascript" defer="true">

   function function1() {
       document.all.myScript.defer = false;
   }

</script> <script id="myScript" language="javascript">

   <input type="button" value=" onClick="function1();">

</script> </body> </html>


     </source>
   
  


Script "language" Example

   <source lang="html4strict">
   

<html> <body> <script id="myScript" language="JavaScript">

   function function1() {
       alert(document.all.myScript.language);
   }

</script> <input type="button" value="Scripting Language" onClick="function1();"> </body> </html>


     </source>
   
  


script "text" Example

   <source lang="html4strict">
   

<html> <body> <script language="JavaScript" id="myS">

   function function1() {
       var m = document.all.myS.text; 
       alert(m);
   }

</script> <input type="button" value="View the script code for function1() function"

      onclick="function1();">

</body> </html>


     </source>