Firebuga ? To powiedz mi jeszcze jak mam go do debugowania używać...
edit>
Nie potrzebny mi kombajn do wyświetlania statusów zmiennych w poszczególnych momentach wykonania który jeszcze kawę parzy.
Chce małą prostą funkcję do wyświetlania zmiennych...
<edit
Napisałem własną funkcję na podstawie powyższej.
Cytat
print_r = function(a)
{
// initiate the return variable
var ret = "";
// If the input variable is a collection object then iterate
if(typeof(a) == 'object')
{
// foreach implementation in javascript
for(var sub in a)
{
var value = a[sub];
ret += "['" + sub + "'] => ";
// incase the value obtained is again a collection
if(typeof(value) == 'object')
{
ret += print_r(value);
}
else
{
// If function print only prototype
if(is_function(value.toSource()))
{
value = value.toSource();
ret += value.substr(0, value.indexOf(')')) + ")<br>\n";
} else {
ret += "'" + html2string(value) + "'<br>\n";
}
}
}
} else {
// Not a collection
ret = typeof(a) + "('" + a + "')";
}
return ret;
}
is_function = function(string)
{
if(string.match(/^function/))
{
return true;
} else {
return false;
}
}
html2string = function(html)
{
var string = new String(html);
return string.replace(/>/g, '>').replace(/</g, '<');
}
display = function(content)
{
var myWindow = window.open('', '', 'width=600,height=250,toolbar=yes')
myWindow.document.write(content)
myWindow.focus()
}
Przy mniejszej ilości danych sprawdza się znakomicie. Niestety przy wywołaniu
display(print_r($('input.chbx[@name=has_sub_controllers_'+ id +']'))), wyrzuca błąd "too much recursion
http://192.168.0.7/templates/default/js/print_r.js Line 23"