JavaScript DHTML/Development/Boolean Utilities

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

Choose value based on boolean expression

<html>
<head>
<title>DynAPI Examples - Functions</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath("./dynapisrc/");
dynapi.library.include("dynapi.library");
dynapi.library.include("dynapi.functions");
dynapi.library.include("dynapi.api");
</script>
</head>
<body>
<font face="arial" size="2">
<script>
var doc=document;
f=dynapi.functions;

doc.write("choose: "+f.choose(0,"red","blue")+"<br><br>");
</script>
</font>
</body>
</html>


<A href="http://www.wbex.ru/Code/JavaScriptDownload/dynapi.zip">dynapi.zip( 791 k)</a>


Convert string to float

<html>
<head>
<title>DynAPI Examples - Functions</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath("./dynapisrc/");
dynapi.library.include("dynapi.library");
dynapi.library.include("dynapi.functions");
dynapi.library.include("dynapi.api");
</script>
</head>
<body>
<font face="arial" size="2">
<script>
var doc=document;
f=dynapi.functions;

doc.write("toFloat: "+f.toFloat("20,000.53")+"<br><br>");
</script>
</font>
</body>
</html>


<A href="http://www.wbex.ru/Code/JavaScriptDownload/dynapi.zip">dynapi.zip( 791 k)</a>


Convert string to integer

<html>
<head>
<title>DynAPI Examples - Functions</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath("./dynapisrc/");
dynapi.library.include("dynapi.library");
dynapi.library.include("dynapi.functions");
dynapi.library.include("dynapi.api");
</script>
</head>
<body>
<font face="arial" size="2">
<script>
var doc=document;
f=dynapi.functions;

doc.write("toInteger: "+f.toInteger("110,013.53")+"<br><br>");
</script>
</font>
</body>
</html>


<A href="http://www.wbex.ru/Code/JavaScriptDownload/dynapi.zip">dynapi.zip( 791 k)</a>


Convert "true", "false" to boolean

<html>
<head>
<title>DynAPI Examples - Functions</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath("./dynapisrc/");
dynapi.library.include("dynapi.library");
dynapi.library.include("dynapi.functions");
dynapi.library.include("dynapi.api");
</script>
</head>
<body>
<font face="arial" size="2">
<script>
var doc=document;
f=dynapi.functions;

doc.write("toBoolean: "+f.toBoolean("true")+"<br><br>");
</script>
</font>
</body>
</html>


<A href="http://www.wbex.ru/Code/JavaScriptDownload/dynapi.zip">dynapi.zip( 791 k)</a>