javascript - Fehler beim laden der Quelle: http://localhost/js/m.js

Warum, oh warum, oh warum... ich kann nicht herausfinden, warum ich immer diese Fehlermeldung bekommen. Ich glaube, ich könnte Weinen.

/*** common functions  */
function GE(id) { return document.getElementById(id); }

function changePage(newLoc) {
   nextPage = newLoc.options[newLoc.selectedIndex].value

   if (nextPage != "")
   {
      document.location.href = nextPage
   }
 }

function isHorizO(){
  if (navigator.userAgent.indexOf('iPod')>-1)
    return (window.orientation == 90 || window.orientation==-90)? 1 : 0;
   else   return 1;

}

function ShowHideE(el, act){
    if (GE(el)) GE(el).style.display = act;
}

function KeepTop(){
    window.scrollTo(0, 1);
}

/* end of common function */

var f = window.onload; 
if (typeof f == 'function'){
    window.onload = function() {
        f();
        init();
    }
}else window.onload = init;

function init(){
    if (GE('frontpage')) init_FP();
    else {
        if (GE('image')) init_Image();
        setTimeout('window.scrollTo(0, 1)', 100); 
     }

    AddExtLink();
}

function AddExtLink(){
    var z = GE('extLink');
    if (z){
        z = z.getElementsByTagName('a');
        if (z.length>0){
            z = z[0];
            var e_name = z.innerHTML;
            var e_link = z.href;

            var newOption, oSe;
            if (GE('PSel')) oSe = new Array(GE('PSel'));
            else
                oSe = getObjectsByClassName('PSel', 'select')

            for(i=0; i<oSe.length; i++){
                newOption = new Option(e_name, e_link);
                oSe[i].options[oSe[i].options.length] = newOption;
            }
        }
    }
}

/* fp */
function FP_OrientChanged() {
    init_FP();
}

function init_FP() {
  // GE('orientMsg').style.visibility = (!isHorizO())? 'visible' : 'hidden';
}

/* gallery */
function GAL_OrientChanged(link){
    if (!isHorizO()){
        ShowHideE('vertCover', 'block');
        GoG(link);
    }
    setTimeout('window.scrollTo(0, 1)', 500);
}
function init_Portfolio() {
 //  if (!isHorizO())
 //      ShowHideE('vertCover', 'block');
}
function ShowPortfolios(){
    if (isHorizO()) ShowHideE('vertCover', 'none');
}

var CurPos_G = 1
function MoveG(dir) {
    MoveItem('G',CurPos_G, dir);
}

/* image */
function init_Image(){
    //check for alone vertical images
    PlaceAloneVertImages();
}
function Img_OrtChanged(){
    //CompareOrientation(arImgOrt[CurPos_I]);
    //setTimeout('window.scrollTo(0, 1)', 500);
}

var CurPos_I = 1
function MoveI(dir) {
    CompareOrientation(arImgOrt[CurPos_I+dir]);
    MoveItem('I',CurPos_I, dir);
}

var arImgOrt = new Array(); //orientation: 1-horizontal, 0-vertical
var aModeName = new Array('Horizontal' , 'Vertical');
var arHs = new Array();

function getDims(obj, ind){
    var arT = new Array(2);

    arT[0] = obj.height; 
    arT[1] = obj.width;


     //arWs[ind-1] = arT;
    arHs[ind] = arT[0];

     //**** (arT[0] > arT[1]) = (vertical image=0)
     arImgOrt[ind] = (arT[0] > arT[1])? 0 : 1;

    //todor debug
    if(DebugMode) {
        //alert("["+obj.width+","+obj.height+"] mode="+((arT[0] > arT[1])? 'verical' : 'hoziontal'))
        writeLog("["+obj.width+","+obj.height+"] mode="+((arT[0] > arT[1])? 'verical' : 'hoziontal')+' src='+obj.src)
    }        
     if (arImgOrt[ind]) {
        GE('mi'+ind).className = 'mImageH';
     }

}
function CompareOrientation(imgOrt){
    var iPhoneOrt = aModeName[isHorizO()];
    GE('omode').innerHTML = iPhoneOrt;
    //alert(imgOrt == isHorizO())
    var sSH = (imgOrt == isHorizO())? 'none' : 'block';
    ShowHideE('vertCover', sSH); 

    var sL = imgOrt? 'H' : 'V';
    if (GE('navig')) GE('navig').className = 'navig'+ sL ;
    if (GE('mainimage')) GE('mainimage').className = 'mainimage'+sL;
    var sPfL = imgOrt? 'Port-<br>folios' : 'Portfolios' ;
    if (GE('PortLnk')) GE('PortLnk').innerHTML = sPfL;

}

function SetGetDim( iMInd){
    var dv = GE('IImg'+iMInd);

    if (dv)   {
        var arI = dv.getElementsByTagName('img');
        if (arI.length>0){
            var oImg =  arI[0];
            oImg.id = 'Img'+iMInd;
            oImg.className = 'imageStyle';
             //YAHOO.util.Event.removeListener('Img'+iMInd,'load');
             YAHOO.util.Event.on('Img'+iMInd, 'load', function(){GetDims(oImg,iMInd);}, true, true);
           //oImg.addEventListener('load',GetDims(oImg,iMInd),true);
        }
    }
}
var occ = new Array();
function PlaceAloneVertImages(){
    var iBLim, iELim;
    iBLim = 0;
    iELim = arImgOrt.length;
    occ[0] = true;
    //occ[iELim]=true;

    for (i=1; i<iELim; i++){
        if ( arImgOrt[i]){//horizontal image
            occ[i]=true;
            continue;
        }else { //current is vertical
            if (!occ[i-1]){//previous is free-alone. this happens only the first time width i=1
                occ[i] = true;
                continue;
            }else {
                if (i+1 == iELim){//this is the last image, it is alone and vertical
                    GE('mi'+i).className = 'mImageV_a'; //***** expand the image container
                }else {
                    if ( arImgOrt[i+1] ){
                        GE('mi'+i).className = 'mImageV_a';//*****expland image container
                        occ[i] = true;
                        occ[i+1] = true;
                        i++;
                        continue;
                    }else { //second vertical image
                        occ[i] = true;
                        occ[i+1] = true;
                        if (arHs[i]>arHs[i+1]) GE('mi'+(i+1)).style.height =  arHs[i]+'px';
                        i++;
                        continue;
                    }
                }
            }

        }


    }
    //arImgOrt

}

function AdjustWebSiteTitle(){

    //if (GE('wstitle')) if (GE('wstitle').offsetWidth > GE('wsholder').offsetWidth) {
    if (GE('wstitle')) if (GE('wstitle').offsetWidth > 325) {
        ShowHideE('dots1','block');
        ShowHideE('dots2','block');
    }
}

function getObjectsByClassName(className, eLTag, parent){
    var oParent;
    var arr = new Array();
    if (parent) oParent = GE(parent); else oParent=document;
    var elems = oParent.getElementsByTagName(eLTag);
    for(var i = 0; i < elems.length; i++)
    {
        var elem = elems[i];
        var cls = elem.className
        if(cls == className){
            arr[arr.length] = elem;
        }
    }
    return arr;
}



////////////////////////////////
///
//todor debug 
var DebugMode = (getQueryVariable("debug")=="1")
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  var sRet = ""
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
        sRet = pair[1];
    }
  }
  return sRet
  //alert('Query Variable ' + variable + ' not found');
} 
var oLogDiv=''
function writeLog(sMes){
    if(!oLogDiv) oLogDiv=document.getElementById('oLogDiv')
    if(!oLogDiv) {
        oLogDiv = document.createElement("div");
        oLogDiv.style.border="1px solid red"
        var o = document.getElementsByTagName("body")
        if(o.length>0) {
            o[0].appendChild(oLogDiv)
        }
    }        
    if(oLogDiv) {
        oLogDiv.innerHTML = sMes+"<br>"+oLogDiv.innerHTML
    }
}
  • Gedankengang: Etwas funktioniert nicht und ist frustrierend, gehen Sie zu stackoverflow, erstellen von Einzel-Wort-Frage "Warum", dump eine Reihe von code ohne Erklärungen, Fragen, warum all die downvotes. Wenn Sie möchten, helfen post eine kohärente Frage mit entsprechenden details.
  • Warum, oh warum, oh warum... tun die Leute Fragen stellen würde? Nun, das ist eine Frage 😉
InformationsquelleAutor n00b0101 | 2010-01-08
Schreibe einen Kommentar