philter is fully compatible with : IE 6.0+, Opera 7.0+, Konqueror 3.1.99+,
[old-projects.git] / philter / philter / include / philter.js
index f7a9c6a..41a9122 100644 (file)
@@ -6,14 +6,6 @@
 * Copyright: See COPYING files that comes with this distribution
 ********************************************************************************/
 
-function ta_onfocus(obj) {
-    obj.setAttribute('rows', '10');
-}
-
-function ta_onblur(obj) {
-    obj.setAttribute('rows', '2');
-}
-
 function text_onfocus(object,val) {
     if(object.value == val)
         object.value = '';
@@ -107,16 +99,17 @@ var matches_i = 0;
 function createActionSelect(data,base) {
     var i,j;
     var select = document.createElement("select");
+    var sel = 0;
     select.name = base+'[0]';
 
-    for(i=0, j=0; i<actions_list.length; i++)
-        if(actions_list[i])
-            select.options[j++] = new Option(actions_list[i],i,false,(data==i));
-
-    select.setAttribute("onchange", "changeRow(this,actions_func)");
+    for(i=0, j=0; i<actions_list.length; i++) {
+        if(data==i) sel = j;
+        if(actions_list[i]) select.options[j++] = new Option(actions_list[i],i,false,(data==i));
+    }
 
-    if(select.selectedIndex<0)
-        select.selectedIndex = 0;
+    select.selectedIndex = sel;
+    select.onchange = function () { changeRow(this,actions_func); };
+    
     return select;
 }
 
@@ -130,7 +123,7 @@ function createActionRow(Node,data) {
     var del = document.createElement("input");
     del.setAttribute("type", "submit");
     del.setAttribute("value", "Del");
-    del.setAttribute("onclick", "parentNode.parentNode.removeChild(parentNode)");
+    del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
     div.appendChild(del);
 
     div.appendChild(document.createTextNode(" "));
@@ -150,16 +143,17 @@ function newAction() {
 function createMatchSelect(data,base) {
     var i,j;
     var select = document.createElement("select");
+    var sel = 0;
     select.name = base+'[0]';
 
-    for(i=0, j=0; i<matches_list.length; i++)
-        if(matches_list[i])
-            select.options[j++] = new Option(matches_list[i],i,false,(data==i));
+    for(i=0, j=0; i<matches_list.length; i++) {
+        if(data==i) sel = j;
+        if(matches_list[i]) select.options[j++] = new Option(matches_list[i],i,false,(data==i));
+    }
 
-    select.setAttribute("onchange", "changeRow(this,matches_func)");
+    select.selectedIndex = sel;
+    select.onchange = function () { changeRow(this,matches_func); };
 
-    if(select.selectedIndex<0)
-        select.selectedIndex = 0;
     return select;
 }
 
@@ -173,7 +167,7 @@ function createMatchRow(Node,data) {
     var del = document.createElement("input");
     del.setAttribute("type", "submit");
     del.setAttribute("value", "Del");
-    del.setAttribute("onclick", "parentNode.parentNode.removeChild(parentNode)");
+    del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
     div.appendChild(del);
 
     div.appendChild(document.createTextNode(" "));