Fixnuta nekompatibilita multiinsert JS kodu s Firefoxem
authorThomas Mudrunka <tomas@mudrunka.cz>
Tue, 23 Aug 2011 23:22:17 +0000 (01:22 +0200)
committerThomas Mudrunka <tomas@mudrunka.cz>
Tue, 23 Aug 2011 23:22:17 +0000 (01:22 +0200)
index.php

index a019ae4b8b388520f6d28554e9323669037166dd..a2423df11502a2f1d3fc6fbe53456338784269e1 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -327,7 +327,7 @@ EOF;
 
                $action = $action ? " action='$action'" : false;
                $html="<form$action method='POST'>"; //TODO: use $this->form()
-               if($multi_insert) $html.='<div name="input_set" style="float:left; border:1px solid grey;">';
+               if($multi_insert) $html.='<span><div name="input_set" style="float:left; border:1px solid grey; padding: 1px; margin: 1px;">';
                //$html.=$this->input('table', $class, 'hidden');
                foreach($columns as $column)    {
                        $html.=T($class).':<b>'.T($column['Field']).'</b>: ';
@@ -349,19 +349,17 @@ EOF;
                        $html.='<br />';
                }
 
-               if($multi_insert) {
-                       //TODO, move to separate JS file
+               if($multi_insert) { //TODO, move to separate JS file
                        $html.=<<<EOF
-                       </div>
-                       <span name="input_set_next"></span><br style="clear:both" />
+                       </div></span>
+                       <br style="clear:both" />
                        <script>
                                function duplicate_element(what, where) {
-                                       document.getElementsByName(where)[0].outerHTML =
-                                               document.getElementsByName(what)[0].outerHTML
-                                               + document.getElementsByName(where)[0].outerHTML;
+                                       var node = document.getElementsByName(what)[0];
+                                       node.parentNode.appendChild(node.cloneNode(true));
                                }
                        </script>
-                       <a href='#' onClick="duplicate_element('input_set', 'input_set_next')">+</a>
+                       <a href='#' onClick="duplicate_element('input_set')">+</a>
 EOF;
                }
 
This page took 0.153445 seconds and 4 git commands to generate.