DOMAIN REDIRECT PROBLEM WITH JQUERY / JAVASCRIPT

Posted by GiovanniDema on Stack Overflow See other posts from Stack Overflow or by GiovanniDema
Published on 2010-06-17T14:22:55Z Indexed on 2010/06/17 14:23 UTC
Read the original article Hit count: 257

Hi guys, first time here.

I got a strange problem. I have a fullscreen image scaler javascript (as GOTOCHINA website) that works very well on my website.

Then, I purchased a domain redirect pointing on my website and when redirecting suddenly internet explorer 7 and internet explorer 8 give me this error

Messagge: is not a valid argument. Line: 34 Char: 17 URI: http://*****/scaler.js

The script is

var db=document.body;
var imag=document.getElementById('wallpaper');
 var dbsize={};
 var imgsrc=imag.src; 
 var keyStop=function(e){
  var e=window.event||e||{};
  var tag=e.target.tagName.toLowerCase();
  if(tag!='textarea'&&!(tag=='input'&&(e.target.type=='text'||e.target.type=='password'))){ 
   if(e.keyCode==32||e.keyCode==39||e.keyCode==40){ 
    if(e.preventDefault)e.preventDefault();
    else e.returnValue=false;
   }
  }
 }
 if(this.addEventListener)window.addEventListener('keydown',keyStop,false);
 else window.attachEvent('onkeydown',keyStop);

setInterval(function(){
  window.scrollTo(0,0);
  if(imag.complete){ 
   if(db.clientWidth!=dbsize.w||db.clientHeight!=dbsize.h||imag.src!=imgsrc){ 
    imgsrc=imag.src; 
    var dbsizew=db.clientWidth; 
    var dbsizeh=db.clientHeight; 
    var newwidth=Math.round(dbsizeh*(imag.offsetWidth/imag.offsetHeight)); 
                var nextvar=dbsizew>newwidth?dbsizew:newwidth;
                imag.style.width=nextvar+'px';

   }
  }
 },300);

In other words when i open the official website everything's working correctly. When i open redirect domain pointing on official website... the previous error appears. The line is exactly this -> imag.style.width=nextvar+'px';

Thanks in advance

Giovanni

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery