Fehler! Bitte helfen! IE mag nicht!

In dem verkleinerten Screenshot kann man die Fehlermeldung nicht richtig erkennen / lesen :confused:
 
Der Fehler selber sagt nicht mehr! Der dazugehörige Code besteht aus folgenden Teilen:

PHP:
function smilie(theSmilie) {
	addText(" " + theSmilie, "", false, document.bbform);
}

function bbcode(theTag) {
	var selectedText = getSelectedText(document.bbform);
	addText("[" + theTag + "]" + selectedText + "[/" + theTag + "]", "", false, document.bbform);
}
Und:

PHP:
<img src="images/smilies/wub.gif" border="0" onclick="smilie('-wub- ')" onmouseover="this.style.cursor='hand';" \>

oder
PHP:
<img title="Fetter Textn" src="images/buttons/bbcode_fett.gif" border="0" onclick="bbcode('B')" onmouseover="this.style.cursor='hand';" \>
 
Nein der Teil ist es nicht der wichtig ist. In der Fehlermeldung steht ja "myVersion ist undefiniert" das ist aber in den Code Schnipsel nicht enthalten .... ich brauche mehr.

btw Das mit dem "onmouseover="this.style.cursor='hand';"" kannst du meinses Wissens nach einfacher lösen.

mfg

Christopher(Der mehr code Braucht ;))
 
Was nringt der ganze Code? Hier!

Bzw. der Feler bringt nicht mehr Information, deswegen frag ich ja hier!

PHP:
<script language="JavaScript">
function smilie(theSmilie) {
	addText(" " + theSmilie, "", false, document.bbform);
}

function bbcode(theTag) {
	var selectedText = getSelectedText(document.bbform);
	addText("[" + theTag + "]" + selectedText + "[/" + theTag + "]", "", false, document.bbform);
}

function farbe(theTag) {
	var selectedText = getSelectedText(document.bbform);
	addText("[" + theTag + "]" + selectedText + "[/" + theTag + "]", "", false, document.bbform);
}

function addText(theTag, theClsTag, isSingle, theForm)
{
	var isClose = false;
	var message = theForm.message;
	var set=false;
  	var old=false;
  	var selected="";
  	
  	if(navigator.appName=="Netscape" &&  message.textLength>=0 ) { // mozilla, firebird, netscape
  		if(theClsTag!="" && message.selectionStart!=message.selectionEnd) {
  			selected=message.value.substring(message.selectionStart,message.selectionEnd);
  			str=theTag + selected+ theClsTag;
  			old=true;
  			isClose = true;
  		}
		else {
			str=theTag;
		}
		
		message.focus();
		start=message.selectionStart;
		end=message.textLength;
		endtext=message.value.substring(message.selectionEnd,end);
		starttext=message.value.substring(0,start);
		message.value=starttext + str + endtext;
		message.selectionStart=start;
		message.selectionEnd=start;
		
		message.selectionStart = message.selectionStart + str.length;
		
		if(old) { return false; }
		
		set=true;
		
		if(isSingle) {
			isClose = false;
		}
	}
	if ( (myVersion >= 4) && is_ie && is_win) {  // Internet Explorer
		if(message.isTextEdit) {
			message.focus();
			var sel = document.selection;
			var rng = sel.createRange();
			rng.colapse;
			if((sel.type == "Text" || sel.type == "None") && rng != null){
				if(theClsTag != "" && rng.text.length > 0)
					theTag += rng.text + theClsTag;
				else if(isSingle)
					isClose = true;
	
				rng.text = theTag;
			}
		}
		else{
			if(isSingle) isClose = true;
	
			if(!set) {
      				message.value += theTag;
      			}
		}
	}
	else
	{
		if(isSingle) isClose = true;

		if(!set) {
      			message.value += theTag;
      		}
	}

	message.focus();
	
	return isClose;
}	

function getSelectedText(theForm) {
	var message = theForm.message;
	var selected = '';
	
	if(navigator.appName=="Netscape" &&  message.textLength>=0 && message.selectionStart!=message.selectionEnd ) 
  		selected=message.value.substring(message.selectionStart,message.selectionEnd);	
  	
	else if( (myVersion >= 4) && is_ie && is_win ) {
		if(message.isTextEdit){ 
			message.focus();
			var sel = document.selection;
			var rng = sel.createRange();
			rng.colapse;
			
			if((sel.type == "Text" || sel.type == "None") && rng != null){
				if(rng.text.length > 0) selected = rng.text;
			}
		}	
	}
		 
  	return selected;
}
</script>
<table width="490" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <table width="490" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/spacer.gif" width="5" height="5"></td>
        </tr>
        <tr>
          <td background="images/main_topic_<?=$topicpic?>.gif" class="topic"><font color="<?=$topictext?>">NEWS HINZUF&Uuml;GEN </font></td>
        </tr>
        <tr>
          <td>
<?
if($_GET['do'] == "add")
{
$ok = "0";
?>
<form method="POST" action="?p=admin_news_add&do=add_check" enctype="multipart/form-data" name="bbform" onsubmit="return validate(this)" onreset="resetAppletText()" style="margin: 0px;">
  <table width="490" border="0" cellspacing="0" cellpadding="0" class="news_rahmen">
                <tr>
                  <td width="100"  class="admin_news_add_rahmen"><table width="100" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td><input class="allesleer" type="text" value="Titel:" /></td>
                      </tr>
                    </table></td>
                  <td class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td><input class="textfeld" name="titel" type="text" id="titel" maxlength="50" value="<?=$newsvorschautitel?>" /></td>
                      </tr>
                    </table></td>
                <tr>
                  <td class="admin_news_add_rahmen"><table width="100" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td><input class="allesleer" type="text" value="Bild:" /></td>
                      </tr>
                    </table></td>
                  <td class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td><input class="textfeld" name="newsbild" type="text" maxlength="1000" value="<?=$newsvorschaubild?>" /></td>
                      </tr>
                    </table></td>
                <tr>
                  <td class="admin_news_add_rahmen"><table width="100" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td><input class="allesleer" type="text" value="Quelle:" /></td>
                      </tr>
                    </table></td>
                  <td class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td><input class="textfeld" name="quelle" type="text" maxlength="1000" value="<?=$newsvorschauquelle?>" /></td>
                      </tr>
                    </table></td>
                <tr>
                  <td valign="top" class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td><table width="100" border="0" cellspacing="5" cellpadding="0">
                            <tr>
                              <td colspan="3"><input name="text2" type="text" class="allesleer" value="Smilies:" /></td>
                            </tr>
                            <tr>
                              <td align="center"><img src="images/smilies/ausrufezeichen.gif" border="0" onclick="smilie('-!- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/biggrin.gif" border="0" onclick="smilie('-:))- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/blink.gif" border="0" onclick="smilie('-Oo- ')" onmouseover="this.style.cursor='hand';" \></td>
                            </tr>
                            <tr>
                              <td align="center"><img src="images/smilies/cool.gif" border="0" onclick="smilie('-cool- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/dry.gif" border="0" onclick="smilie('-dry- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/fragezeichen.gif" border="0" onclick="smilie('-?- ')" onmouseover="this.style.cursor='hand';" \></td>
                            </tr>
                            <tr>
                              <td align="center"><img src="images/smilies/herz.gif" border="0" onclick="smilie('-herz- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/huh.gif" border="0" onclick="smilie('-huh- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/kotz.gif" border="0" onclick="smilie('-kotz- ')" onmouseover="this.style.cursor='hand';" \></td>
                            </tr>
                            <tr>
                              <td align="center"><img src="images/smilies/laugh.gif" border="0" onclick="smilie('-lach- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/mad.gif" border="0" onclick="smilie('-mad- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/mellow.gif" border="0" onclick="smilie('-mellow- ')" onmouseover="this.style.cursor='hand';" \></td>
                            </tr>
                            <tr>
                              <td align="center"><img src="images/smilies/ohmy.gif" border="0" onclick="smilie('-ohmy- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/pfeil.gif" border="0" onclick="smilie('-pfeil- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/rolleyes.gif" border="0" onclick="smilie('-roll- ')" onmouseover="this.style.cursor='hand';" \></td>
                            </tr>
                            <tr>
                              <td align="center"><img src="images/smilies/sad.gif" border="0" onclick="smilie('-sad- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/sleep.gif" border="0" onclick="smilie('-sleep- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/smile.gif" border="0" onclick="smilie('-:)- ')" onmouseover="this.style.cursor='hand';" \></td>
                            </tr>
                            <tr>
                              <td align="center"><img src="images/smilies/thief.gif" border="0" onclick="smilie('-thief- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/tongue.gif" border="0" onclick="smilie('-:P- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/unsure.gif" border="0" onclick="smilie('-unsure- ')" onmouseover="this.style.cursor='hand';" \></td>
                            </tr>
                            <tr>
                              <td align="center"><img src="images/smilies/wacko.gif" border="0" onclick="smilie('-wacko- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/wink.gif" border="0" onclick="smilie('-wink- ')" onmouseover="this.style.cursor='hand';" \></td>
                              <td align="center"><img src="images/smilies/wub.gif" border="0" onclick="smilie('-wub- ')" onmouseover="this.style.cursor='hand';" \></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table></td>
                  <td valign="top" class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td width="20"><img title="Fetter Textn" src="images/buttons/bbcode_fett.gif" border="0" onclick="bbcode('B')" onmouseover="this.style.cursor='hand';" \></td>
                        <td width="20"><img title="Kursiver Text" src="images/buttons/bbcode_kursiv.gif" border="0" onclick="bbcode('K')" onmouseover="this.style.cursor='hand';" \></td>
                        <td width="20"><img title="Unterstrichener Text" src="images/buttons/bbcode_unterstrichen.gif" border="0" onclick="bbcode('U')" onmouseover="this.style.cursor='hand';" \></td>
                        <td width="20"><img title="Durchgestrichener Text" src="images/buttons/bbcode_durchgestrichen.gif" border="0" onclick="bbcode('S')" onmouseover="this.style.cursor='hand';" \></td>
                        <td width="20"><img title="Oberstrichener Text" src="images/buttons/bbcode_oberstrichen.gif" border="0" onclick="bbcode('O')" onmouseover="this.style.cursor='hand';" \></td>
                        <td width="20"><img title="Blinkender Text" src="images/buttons/bbcode_blinkend.gif" border="0" onclick="bbcode('F')" onmouseover="this.style.cursor='hand';" \></td>
                        <td><select name="select" class="farben">
                            <option style="color:#FF0000" onclick="farbe('Rot')" selected="selected">Rot</option>
                            <option style="color:#0000FF" onclick="farbe('Blau')">Blau</option>
                            <option style="color:#009900" onclick="farbe('Grün')">Grün</option>
                            <option style="color:#E1E100" onclick="farbe('Gelb')">Gelb</option>
                            <option style="color:#00CECE" onclick="farbe('Türkis')">Türkis</option>
                            <option style="color:#FF00FF" onclick="farbe('Rosa')">Rosa</option>
                            </select></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td colspan="8"><textarea class="hugewindow" name="message"><?=$newsvorschaumessage?></textarea></td>
                      </tr>
                    </table></td>
                <tr>
                  <td>&nbsp;</td>
                  <td><table width="100%" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td><input class="buttons" name="submit" type="submit" value="Eintragen" /></td>
                        <td><input name="ok" type="image" src="images/buttons/buttons_vorschau.gif" border="0" value="1" /></td>
                        <td width="100%">&nbsp;</td>
                      </tr>
                    </table></td>
              </table>
</form>
<?
}
if($_GET['do'] == "add_check")
{
?>
<?
{
$ok = $_POST['ok'];
if($ok == 0)	{
					$titel = $_POST['titel'];
					$newsbild = $_POST['newsbild'];
					$quelle = $_POST['quelle'];
					$text = $_POST['message'];

					if(empty($titel) || empty($message))
					{
						if(empty($titel)) print("<center><b>Kein Titel</b></center><br>");
						if(empty($message)) print("<center><b>Kein Text</b></center><br>");
					}
					else
					{
						$timestamp = time();
						$eintragen = mysql_query("INSERT INTO ".$dbprefix."news ( id , titel , timestamp , text , newsbild , quelle ) VALUES ('', '$titel', '$timestamp', '$text', '$newsbild', '$quelle')");
						$eintragen = mysql_query("UPDATE ".$dbprefix."vorschau SET titel = '', bild = '', quelle = '', message = ''");

						echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=?p=admin_ok\" target=\"_self\">";
			
					}

				}
				else
				{
					$titel = $_POST['titel'];
					$bild = $_POST['newsbild'];
					$quelle = $_POST['quelle'];
					$message = $_POST['message'];
					
					mysql_query("UPDATE ".$dbprefix."vorschau SET titel = '$titel', bild = '$newsbild', quelle = '$quelle', message = '$message'");
					echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=?p=admin_news_vorschau&do=vorschau \">";
}
}
}
?>
</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
 
Hi,
also wenn ich das richtig sehe ist genau das der Fall was da auch als Fehler steht. Die Variabel myVersion ist nicht definiert. Du benutzt die zwar bei zwei if-Abfragen nämlich

in Zeile 54:
Code:
if ( (myVersion >= 4) && is_ie && is_win)

und Zeile 98:
Code:
else if( (myVersion >= 4) && is_ie && is_win )

aber deklariert hast du myVersion nirgends und belegt demnach auch nicht. Weiß jetzt nicht genau was du da abfragen willst, aber da liegt in meinen Augen der Fehler.

Gruß
 
Das ist die Abfrage für den IE ob er aktiv ist! Der Schnipsel da unten ist leider net von mir!

Ich habe das jetzt mal deklariert:

var myAgent = navigator.userAgent.toLowerCase();
var myVersion = parseInt(navigator.appVersion);
var is_ie = ((myAgent.indexOf("msie") != -1) && (myAgent.indexOf("opera") == -1));
var is_win = ((myAgent.indexOf("win")!=-1) || (myAgent.indexOf("16bit")!=-1));

Jetzt gehts :)
 
Zuletzt bearbeitet:

Neue Beiträge

Zurück