Simple Example
HTML
<pre id="javascript_block">
Hello World!
Hello World!
/**
* This is a test function
* @return nothing
*/
function test(msg, status) {
if( status ) {
alert('show me the money!'); // just kidding
return true;
} else {
alert("no money here");
return false;
}
}
</pre>
Javascript
jQuery("#javascript_block").codeview();
jQuery("#javascript_block").codeview({
fontSize: "1.2em",
tabToSpace: -1,
feedColor: false
});
Demo
Hello World!
Hello World!
/**
* This is a test function
* @return nothing
*/
function test(msg, status) {
if( status ) {
alert('show me the money!'); // just kidding
return true;
} else {
alert("no money here");
return false;
}
}
/**
* This is a test function
* @return nothing
*/
function test(msg, status) {
if( status ) {
alert('show me the money!'); // just kidding
return true;
} else {
alert("no money here");
return false;
}
}
Complex Example
HTML
<pre id="javascript_block">
/**
* this is a test function
* keyword: function, var, return, try, catch, true, false
* keyword: function, var, return, try, catch, true, false
*
* @param msg testing message
* @param status testing status
* @return nothing to return
*/
function test(msg, status) {
var test = '123';
var test2 = "12345676";
// keyword: function, var, return, try, catch, true, false
while(true) {
alert('show me the money!');
}
try {
alert("success!");
} catch {
alert("error!");
} finally {
alert('return');
}
if( msg == 'test' ) {
return true;
} else {
return false;
}
}
/**
* this is a test function too
* keyword: function, var, return, try, catch, true, false
*
* @author David Hung
*/
function test2(msg) {
alert('test');
alert("string");
if( true ) {
return true;
} else {
return false;
}
xxif gg
xx if gg
return true;
}
</pre>
Javascript
jQuery("#javascript_block").codeview();
Demo
/**
* this is a test function
* keyword: function, var, return, try, catch, true, false
* keyword: function, var, return, try, catch, true, false
*
* @param msg testing message
* @param status testing status
* @return nothing to return
*/
function test(msg, status) {
var test = '123';
var test2 = "12345676";
// keyword: function, var, return, try, catch, true, false
while(true) {
alert('show me the money!');
}
try {
alert("success!");
} catch {
alert("error!");
} finally {
alert('return');
}
if( msg == 'test' ) {
return true;
} else {
return false;
}
}
/**
* this is a test function too
* keyword: function, var, return, try, catch, true, false
*
* @author David Hung
*/
function test2(msg) {
alert('test');
alert("string");
if( true ) {
return true;
} else {
return false;
}
return true;
}