[TYPO3-german] Javascript nur im Mozilla?

Jochen Graf graf at uni-landau.de
Fri Aug 15 15:59:34 CEST 2008


Hallo,

ich hier ein Script dass ich für die Suche einsetzten möchte, Ziel ist 
es den input:focus auch bei dem IE zu bekommen.

http://www.typotest7.uni-landau.de/fileadmin/template/focus.html

Nun kopierte ich das Javascript in das Template File der Suchmaske, aber 
leider taucht nichts im IE auf?

Doch wenn ich das ganze File
http://www.typotest7.uni-landau.de/fileadmin/template/focus.html

mit dem IE öffne, dann klappts??

hat jemand einen Rat, weshalb das nicht klappt?

hier mal ein Template


Kopiere ich diesen Code lokal auf meinen Rechner und mache eine HTML 
Datei draus, dann klappts auc nur nicht auf dem Typo3 Server.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>input-Felder</title>
  <script type="text/javascript">
   if(document.all) var className = "className";
   else var className = "class";

   window.onload = function() {
     nodes = document.getElementsByTagName("input");
     for(i = 0; i < nodes.length; i++) {
       if((nodes[i].type == "text" || nodes[i].type == "password") && 
!nodes[i].getAttribute("readonly")) {
         nodes[i].onfocus = function() {
           replaceInputClass(this, "input-focus");
             if(this.value == this.defaultValue) this.value = "";
           }
           nodes[i].onblur = function() {
             if(this.value == "" || this.value == this.defaultValue) {
             this.value = this.defaultValue;
             replaceInputClass(this, "input-empty");
           } else replaceInputClass(this, "input-normal");
         }
       }
     }
   }

   function replaceInputClass(obj, newClass) {
     classes = obj.getAttribute(className).split(" ");
     for(i = 0; i < classes.length; i++) if(classes[i].substr(0, 6) == 
"input-") classes[i] = newClass;
     obj.setAttribute(className, classes.join(" "));
   }

  </script>
  <style type="text/css">
      .test { font-family:Verdana; font-size:16px; }
      .input-empty { background:#CCCCCC; }
      .input-normal { background:#00CCCC; }
      .input-focus { background:#CC0000; }
  </style>
</head>
<body>
<h3>Template file for the &quot;macina_searchbox&quot; extension.</h3>
<p><b>Available Markers:</b></p>
<ul>
  <li>###HEADLINE### Displays the Headline</li>
  <li>###ADVANCED### Advanced Search Link</li>
  <li>###SUBMIT### Alttext for the submit button</li>
  <li>###ACTLANG### UID of the actual language</li>
  <li>###SEARCHPID### PID of the Searchpage</li>
</ul>
<!-- ###TEMPLATE### begin -->
<form style="margin-top:0px;" action="###SEARCHPID###" method="post" 
name="searchform" id="searchform" >
<p>
<input style="width:170px;" input type="text" class="test input-empty" 
class="test input-empty" name="tx_indexedsearch[sword]" type="text" 
value="Suchbergiff eingeben" onclick="this.value=''" 
onblur="this.value='Suchbergiff eingeben'"/>
<input type="hidden" name="tx_indexedsearch[_sections]" value="0" />
<input type="hidden" name="tx_indexedsearch[pointer]" value="0" />
<input type="hidden" name="tx_indexedsearch[ext]" value="0" />
<input type="hidden" name="tx_indexedsearch[lang]" value="###ACTLANG###" />
</p>
</form>
<!-- ###TEMPLATE### end -->
</body>
</html>
<!-- rausgenommen am 6.9.2006 - DB (war nach "Suchwort")
<input style="width:28px; height:20px;" 
name="tx_indexedsearch[submit_button]" type="image" 
src="fileadmin/media/search.gif" value="Submit" />
-->


-- 
Mit freundlichen Grüssen

Jochen Graf

Universität Koblenz-Landau / Campus Landau
Arbeitstelle Multimedia/Technik-Administration

Thomas-Nast-Str. 44
76829 Landau

mail: graf at uni-landau.de
fon: 06341-990-224
web:http://www.paeps.uni-landau.de



More information about the TYPO3-german mailing list