View Full Version : Debug???
asian42die4
11-06-2002, 03:51 AM
How do you hide or get rid of debug and error messages that appears when you load a webpage???
beetle
11-06-2002, 03:55 AM
Uh, fix the errors :D
Seriously...what exactly are you trying to do? Debug errors? Or cancel the notification of errors to the user?
glenngv
11-06-2002, 04:01 AM
window.onerror = function(){return true;}
or if you want to customize the error:
window.onerror=errorHandler;
function errorHandler(reason,page,line) {
alert('A JavaScript error has occurred on the page:\n '+page+'\n\nOn line #:\n '+line+'\n\nFor the reason:\n '+reason;
return true;//return true to suppress the error message thrown by the browser
}
asian42die4
11-06-2002, 04:03 AM
Hey beetle firstly thanks for helping me in first attempts of my assignment...
now getting back to my original subject:
I constantly have a error appearing on my screen when i refresh i want to get rid of the notification that appears on your screen when you load up your webpage.
thanks yew
beetle
11-06-2002, 04:04 AM
Well, I know I made a joke about it in my first post, but it really is best to find the error and fix it. What are the details of the error? Is your page online so I can see it?
asian42die4
11-06-2002, 04:15 AM
<script language="javascript">
topv = 170; // the top position of your picture
leftv = 400; // the left position of your picture
startx = 115; // the top position of your sportlight into the image (on start)
starty = 105; // the left position of your spotlight into the image (on start)
function addL(){
xv = tempX - leftv;
if (xv < 0) xv = 0;
if (xv > img_width) xv = img_width;
yv = tempY - topv;
if (yv < 0) yv = 0;
if (yv > img_height) yv = img_height
image.filters.light.MoveLight(1,xv,yv,50,true);
}
function moveL()
{
if (over)
{
if(bback)
{
t = false;
random();
}
else
{
addL();
}
out_of = true;
}
else
{
if (out_of)
{
back_start();
}
}
}
function back_start()
{
bback = false;
if ((((Math.abs(startx - xv) <= 2)) && (Math.abs(starty - yv) <= 2)) || (over == true))
{
timer2 = clearTimeout(timer2);
timer2 = null;
out_of = false;
}
else
{
if (Math.abs(startx - xv) > 2)
{
if (startx < xv) {xv -= 2;}
else {xv += 2;}
}
if (Math.abs(starty - yv) > 2)
{
if (starty < yv)
{yv -= 2;}
else
{yv += 2;}
}
image.filters.light.MoveLight(1,xv,yv,50,true);
timer2 = setTimeout("back_start()",4);
}
}
function random()
{
bxv = tempX - leftv;
byv = tempY - topv;
if ((((Math.abs(bxv - xv) <= 4)) && (Math.abs(byv - yv) <= 4)) || (bback == false))
{
t = true;
bback = false;
timer = clearTimeout(timer);
timer = null;
}
else
{
if (Math.abs(bxv - xv) > 4)
{
if (bxv < xv) {xv -= 4;}
else {xv += 3;}
}
if (Math.abs(byv - yv) > 4)
{
if (byv < yv)
{yv -= 4;}
else
{yv += 4;}
}
image.filters.light.MoveLight(1,xv,yv,50,true);
timer = setTimeout("random()",0);
}
}
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0
var tempY = 0
function getMouseXY(e) {
tempX = event.clientX + document.body.scrollLeft
tempY = event.clientY + document.body.scrollTop
if (tempX < 0){tempX = 0}
if (tempY < 0){tempY = 0}
if (t)
{
moveL();
}
return true
}
</script>
</head>
<body bgcolor="#FFFFFF">
<center>
<div style="position:absolute;" id=img_div name=img_div onmouseover="Javascript:over=true;bback=true;" onmouseout="Javascript:over=false;bback=false">
<img id="image" style="filter:light" src="1.jpg"></div>
</center>
<script language="JavaScript1.2">
</script>
</body>
</html>
</body>
</html>
<script language="javascript">
var img_width = 0;
var img_height = 0;
var xv = startx;
var bxv = 0;
var yv = starty;
var byv = 0;
var over = false;
var bback = false;
var timer = null;
var timer2 = null;
var out_of = false;
var t= true;
image.filters.light.addAmbient(255,255,255,10)
image.filters.light.addPoint(startx,starty,50,255,255,255,255)
img_div.style.left = leftv;
img_div.style.top = topv;
// change the img_width and heigth in the width and heigth of the image to optimalisize the script. ex img_width= 200
img_width = parseInt(image.width);
img_height = parseInt(image.height);
</script>
asian42die4
11-06-2002, 04:17 AM
ok thats my source code
it says T is undefined line 125
but without it the code does not work
hey beetle this is like a code snippet aswell :)
asian42die4
11-06-2002, 04:18 AM
damn weird smiley faces in my code
beetle
11-06-2002, 04:21 AM
Can you highlight line 125? I can't possibly know which it is, I could guess, but I would probably just be wasting time.
To remove the similies, edit the post, and check the checkbox that says 'Disable Smilies in This Post'
asian42die4
11-06-2002, 04:28 AM
<script language="javascript">
topv = 170; // the top position of your picture
leftv = 400; // the left position of your picture
startx = 115; // the top position of your sportlight into the image (on start)
starty = 105; // the left position of your spotlight into the image (on start)
function addL(){
xv = tempX - leftv;
if (xv < 0) xv = 0;
if (xv > img_width) xv = img_width;
yv = tempY - topv;
if (yv < 0) yv = 0;
if (yv > img_height) yv = img_height
image.filters.light.MoveLight(1,xv,yv,50,true);
}
function moveL()
{
if (over)
{
if(bback)
{
t = false;
random();
}
else
{
addL();
}
out_of = true;
}
else
{
if (out_of)
{
back_start();
}
}
}
function back_start()
{
bback = false;
if ((((Math.abs(startx - xv) <= 2)) && (Math.abs(starty - yv) <= 2)) || (over == true))
{
timer2 = clearTimeout(timer2);
timer2 = null;
out_of = false;
}
else
{
if (Math.abs(startx - xv) > 2)
{
if (startx < xv) {xv -= 2;}
else {xv += 2;}
}
if (Math.abs(starty - yv) > 2)
{
if (starty < yv)
{yv -= 2;}
else
{yv += 2;}
}
image.filters.light.MoveLight(1,xv,yv,50,true);
timer2 = setTimeout("back_start()",4);
}
}
function random()
{
bxv = tempX - leftv;
byv = tempY - topv;
if ((((Math.abs(bxv - xv) <= 4)) && (Math.abs(byv - yv) <= 4)) || (bback == false))
{
t = true;
bback = false;
timer = clearTimeout(timer);
timer = null;
}
else
{
if (Math.abs(bxv - xv) > 4)
{
if (bxv < xv) {xv -= 4;}
else {xv += 3;}
}
if (Math.abs(byv - yv) > 4)
{
if (byv < yv)
{yv -= 4;}
else
{yv += 4;}
}
image.filters.light.MoveLight(1,xv,yv,50,true);
timer = setTimeout("random()",0);
}
}
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0
var tempY = 0
function getMouseXY(e) {
tempX = event.clientX + document.body.scrollLeft
tempY = event.clientY + document.body.scrollTop
if (tempX < 0){tempX = 0}
if (tempY < 0){tempY = 0}
if (t)
{
moveL();
}
return true
}
</script>
</head>
<body bgcolor="#FFFFFF">
<center>
<div style="position:absolute;" id=img_div name=img_div onmouseover="Javascriptver=true;bback=true;" onmouseout="Javascriptver=false;bback=false">
<img id="image" style="filter:light" src="1.jpg"></div>
</center>
<script language="JavaScript1.2">
</script>
</body>
</html>
</body>
</html>
<script language="javascript">
var img_width = 0;
var img_height = 0;
var xv = startx;
var bxv = 0;
var yv = starty;
var byv = 0;
var over = false;
var bback = false;
var timer = null;
var timer2 = null;
var out_of = false;
var t= true;
image.filters.light.addAmbient(255,255,255,10)
image.filters.light.addPoint(startx,starty,50,255,255,255,255)
img_div.style.left = leftv;
img_div.style.top = topv;
// change the img_width and heigth in the width and heigth of the image to optimalisize the script. ex img_width= 200
img_width = parseInt(image.width);
img_height = parseInt(image.height);
</script>
asian42die4
11-06-2002, 04:31 AM
discard that last blue if (t) coz like i forgot to delete it hahaha
beetle
11-06-2002, 04:32 AM
Dude, you can edit any post you make...in the regular forum view the edit button is at the top-right corner of east post...
asian42die4
11-06-2002, 07:49 AM
Any one with ideas that can help me with this little debug msg problem
asian42die4,
I don't want to appear as if I'm picking on you, but most of your questions suffer from the following problems:
1) Gross lack of description/articulation of what the problem is
2) Dumping full page lengths of script, instead of doing some work yourself first, and posting only the problematic code.
This is why we created the Posting Guideline, which can be viewed here: http://www.codingforums.com/showthread.php?s=&threadid=2090
asian42die4
11-06-2002, 08:19 AM
Sorry about that, sometimes I have lack of information, but I have done the work... but like heres the thing i under stand how it works but my knowledge of Javascript is minimal, but like if i use the VB i know, they do not declare it as a integer...
Roy Sinclair
11-06-2002, 02:14 PM
If the blue highligted line is the one you're always seeing the error on then it's obvious the problem is that the global variable t isn't being declared and is only given a value in other functions (which therefore declare it as a global variable by default). The code is checking the value of t before it's been given a value so it doesn't exist and thus gives the error. Declare the variable, give it a default value and the error should go away.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.