Here is small bookmarklet, which allows to edit the web page for any site (ok, You could save the results on Your local machine only).
javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
Here is small bookmarklet, which allows to edit the web page for any site (ok, You could save the results on Your local machine only).
javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
There is a special algorithm for comparision strings, which sound similar (Soundex).
Here is JavaScript Soundex implementation:
function soundex ( s_src )
{
var s_rez = "0000" ;
var new_code, prev, idx
a_codes = { "bfpv": 1, "cgjkqsxz":2, "dt": 3, "l": 4, "mn": 5, "r": 6 };
s_src = s_src.toLowerCase().replace(/ /g,"")
if ( s_src.length < 1) {
return(s_rez);
}
s_rez = s_src.substr(0,1);
prev = "0";
for ( idx = 1 ; idx < s_src.length ; idx++) {
new_code = "0";
cur_char = s_src.substr(idx,1)
for (s_code in a_codes)
if (s_code.indexOf(cur_char) >= 0)
{ new_code = a_codes[ s_code ] ; break ; }
if (new_code != prev && new_code != "0" ) {
s_rez += new_code;
}
prev = new_code;
}
s_rez = s_rez + "0000"
return s_rez.substr(0,4);
}
<script type="text/javascript">
function buildTable(n_rows,n_columns) {
var the_body = document.getElementsByTagName("body")[0];
var new_table = document.createElement("table");
var new_tbody = document.createElement("tbody");
var new_row, new_col, new_text ;
for(row=1;row<=n_rows;row++) {
new_row = document.createElement("tr");
new_row.className = "tr"+row ;
for(col=1;col<=n_columns;col++) {
new_col = document.createElement("td");
new_col.className = "td"+col ;
new_text = document.createTextNode("text:" + row + ":" + col );
new_col.appendChild(new_text);
new_row.appendChild(new_col);
}
new_tbody.appendChild(new_row);
}
new_table.appendChild(new_tbody);
new_table.setAttribute("border", "2");
the_body.appendChild(new_table);
return new_table ;
}
</script>
<body>
Example:
<script type="text/javascript">
buildTable(4,3)
</script>
</body>
There is also interesting article on oreillynet.com, discussing performance improvement for such operations.