File: test.html

Recommend this page to a friend!
  Classes of Leo Otero   jsHelper   test.html   Download  
File: test.html
Role: Example script
Content type: text/plain
Description: Example
Class: jsHelper
Add helper functions to String and Array objects
Author: By
Last change: Update of test.html
Date: 2 years ago
Size: 1,870 bytes
 

Contents

Class file image Download
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="jsHelper.js"></script> <script> var testString = "text"; var testString2 = "my monkey Amelio and I"; var testArray = ["text", 2, 123, 4, "k", ""]; var testArray2 = []; var testObject = { name: function(){alert()}, inventedVar:null }; var leoIsset; var myfunction = "hello"; function hello(name, surname){ console.log("Hello " + name + " " + surname); } // lets try if(!jsHelper.isset(leoIsset) || !jsHelper.isset(testObject.inventedVar)){ console.log("These vars are null or undefined"); } if(jsHelper.isObject(testObject)){ console.log("This is a object"); } if(testArray2.empty()){ console.log("The array is empty :( "); } jsHelper.callFunctionByName(myfunction, [ "Leandro", "Otero" ]); console.log("TestString2 before: " + testString2); console.log("TestString2 after replacement: " + testString2.strReplaceAll(" ","")); console.log("TestString2 after replacement (only with 2): " + testString2.strReplaceAll(" ","",2)); if(testArray[5].empty()){ console.log("The string is empty :("); } if(testArray.in_array(123)){ console.log("Element found in the array :)") } var stringFullTrim = testString2.fullTrim(); console.log(stringFullTrim); window.onload = function(){ var newElement = {name:"a", text: "es un link", attrs: {href:"http://www.google.es",style:"color:red;"}}; jsHelper.createDOMElement(newElement,"box1"); }; </script> </head> <body> <div id ="box1"> </div> </body> </html>