Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Question on JavaScript

Reply
Thread Tools

Question on JavaScript

 
 
Dorothy Mantooth
Guest
Posts: n/a
 
      06-30-2008
My company is switching from using a vendor DNS server to our own as
well as creating a new network. We want to verify whether or not our
customers can "reach" our new network so we have placed some
JavaScript on the logon page of one of our applications to check for
the existence of an image on the new network. We have had over 20,000
successes and about 300 failures. I want to know if the failures
could be do to the following scripting code or if we should continue
to look at the DNS, ACL's, etc. I want to rule out the script. The
failures are falling into the isBad funciton and we are logging.

function testImage(URL)
var tester=new Image();
tester.onload=isGood;
tester.onerror=isBad;
tester.src=URL;
}


function isGood() {
if( debug ) {
alert('Image exists!');
//Log success (around 20,000)
}
}

function isBad() {
if( debug ) {
alert('Image does no exist!');
//Log failure (around 300)
}
}
 
Reply With Quote
 
 
 
 
Joshua Cranmer
Guest
Posts: n/a
 
      06-30-2008
[ Sorry for top-posting ]
JavaScript != Java. Moving to c.l.js
Dorothy Mantooth wrote:
> My company is switching from using a vendor DNS server to our own as
> well as creating a new network. We want to verify whether or not our
> customers can "reach" our new network so we have placed some
> JavaScript on the logon page of one of our applications to check for
> the existence of an image on the new network. We have had over 20,000
> successes and about 300 failures. I want to know if the failures
> could be do to the following scripting code or if we should continue
> to look at the DNS, ACL's, etc. I want to rule out the script. The
> failures are falling into the isBad funciton and we are logging.
>
> function testImage(URL)
> var tester=new Image();
> tester.onload=isGood;
> tester.onerror=isBad;
> tester.src=URL;
> }
>
>
> function isGood() {
> if( debug ) {
> alert('Image exists!');
> //Log success (around 20,000)
> }
> }
>
> function isBad() {
> if( debug ) {
> alert('Image does no exist!');
> //Log failure (around 300)
> }
> }



--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about question mark in JavaScript Jimolo Javascript 2 01-20-2008 05:02 PM
Generated JavaScript vs. Manually Created JavaScript: Which one comes first? Nathan Sokalski ASP .Net 4 11-08-2007 07:24 AM
JavaScript or not JavaScript Mark Rae ASP .Net 36 09-09-2006 01:12 PM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
Javascript -> Applet: variable reset after method call from javascript?! mcdeveloper Java 1 06-13-2006 08:34 AM



Advertisments