Tutorialspoint

Compile and Execute C++0x Onlinej

<html>
   <head>
      <title>JavaScript Math LN10 Property</title>
   </head>
   <body>
      <script>
         var property_value = Math.LN10;
         document.write("Property Value: " + property_value);
      </script>
   </body>
</html>

Compile and Execute C++0x Onlinej

<html>
 <head>
 <title>JavaScript href vs onClick()</title>
 <script>
 function myFunc() {
 var v = 0;
 for (var j=0; j<1000; j++) {
 v+=j;
 }
 alert(v);
 }
 </script>
 <a href="javascript:myFunc()">href</a>
 <a href="#" onclick="javascript:myFunc()">onclick</a>
 </head>
 <body>
 </body>
</html>

Compile and Execute C++0x Onlinej

<html>

 <head>
 <title>JavaScript setSeconds Method</title>
 </head>

 <body>

 <script>
 var dt = new Date("December 30, 2017 11:20:25");
 dt.setSeconds( dt.getSeconds() + 10 );
 document.write( dt );
 </script>

 </body>
</html>

Compile and Execute C++0x Onlinej

<html>

 <head>
 <title>JavaScript setHours Method</title>
 </head>

 <body>

 <script>
 var dt = new Date();
 dt.setHours( dt.getHours() + 2 );
 document.write( dt );
 </script>

 </body>
</html>

Compile and Execute C++0x Onlinej

<html>

 <head>
 <title>JavaScript Dates</title>
 </head>

 <body>

 <script>
 var date, res;
 date = new Date();
 res = date.toISOString();

 document.write(res);
 </script>

 </body>
</html>

Compile and Execute C++0x Onlinej

<html>

 <head>
 <title>JavaScript setMinutes Method</title>
 </head>

 <body>

 <script>
 var dt = new Date();
 dt.setMinutes( dt.getMinutes() + 30 );
 document.write( dt );
 </script>

 </body>
</html>

Compile and Execute C++0x Onlinej

<html>

 <head>
 <title>JavaScript setDate Method</title>
 </head>

 <body>

 <script>
 var dt = new Date("December 30, 2017 11:20:25");
 dt.setDate( dt.getDate() - 10 );
 document.write( dt );
 </script>

 </body>
</html>

Compile and Execute C++0x Onlinej

<!DOCTYPE html>
<html>
<body>
<script>
 var date1, date2;
 date1 = new Date();
 document.write(date1);

 date2 = new Date( "Dec 15, 2014 21:20:15" );
 document.write("<br>"+date2);
 if (date1 > date2) {
 document.write("<br>Date1 is the recent date.");
 } else {
 document.write("<br>Date 2 is the recent date.");
 }
</script>
</body>
</html>

Compile and Execute C++0x Onlinej

<!DOCTYPE html>
<html>
<body>
<button onclick="timeFunction()">Submit</button>
<script>
function timeFunction() {
 setTimeout(function(){ alert("After 5 seconds!"); }, 5000);
}
</script>
<p>Click the above button and wait for 5 seconds.</p>
</body>
</html>

Compile and Execute C++0x Onlinej

<!DOCTYPE html>
<html>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
 $.myjQuery = function() {
 alert("jQuery");
 };
 $(document).ready(function() {
 alert("Welcome!");
 });
 function display() {
 $.myjQuery();
};
</script>
<input type="button" value="submit" onclick=" display();">
</body>
</html>

1 2 3 4 5 6 7 ... 87 Next
Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.