Page 1 of 2
Please test my JavaScript widget
Posted: 2007-08-16 02:29pm
by Darth Wong
For those of you who don't hang around the SLAM forum, I'm testing some major revisions to my CreationTheory.Org page, including a new page which is intended to illustrate the difference between how creationists handle sequential event probability and how it's supposed to be done.
http://www.stardestroyer.net/Creationis ... ge03.xhtml
I've tested the dice-rolling widgets on Firefox and Konqueror, both on Linux. Can anyone confirm proper operation on other browsers like Safari, IE7, IE6, or Opera? The first widget is supposed to look like ten dice, all in a horizontal row. The second one starts as one die, and eventually becomes ten.
Posted: 2007-08-16 02:31pm
by Bounty
Works fine in Opera 9.2 on Linux.
Posted: 2007-08-16 02:52pm
by rhoenix
Works fine on Camino(Mozilla) on Mac OS 10.4.10.
Works fine also on Opera & Firefox, on Mac OS 10.4.10.
Posted: 2007-08-16 02:53pm
by EnsGabe
Bounty wrote:Works fine in Opera 9.2 on Linux.
Confirmed. (9.23/Linux)
Posted: 2007-08-16 02:56pm
by Crown
Page one works fine in Safari 2.0.4 (haven't installed FireFox for Mac yet, did I mention that I got a new MacBook? Well I have, and it's fab!
)
Posted: 2007-08-16 03:19pm
by Resinence
No problems in Safari 3.0.3
Posted: 2007-08-16 04:13pm
by FSTargetDrone
Bounty wrote:Works fine in Opera 9.2 on Linux.
Ditto for Opera 9.2 WinXP.
However, I
cannot get it to work on IE 7.0.5730.11 on WinXP. I turned Java back on to test, but no joy.
Anyone else?
Posted: 2007-08-16 04:37pm
by phongn
Fails using IE7 (7.0.2600.16512) on Windows Vista (x86 and x64).
Succeeds using Safari 3.0.3 beta (522.15.5) and Firefox 2.0.0.6 on Windows Vista
Succeeds using Konqueror 3.5.4 and Firefox 1.5.0.12 on CentOS Linux 5.
Posted: 2007-08-16 04:42pm
by FSTargetDrone
I just tried the latest Opera, Firefox and IE (same version as I mentioned above) browsers on my WinXP laptop, and again the IE fails.
Posted: 2007-08-16 04:49pm
by Resinence
As for the IE7 issue, confirmed.
Error output:
Code: Select all
Line 12
Char 3
Error: Object doesn't support this property or method.
Code 0
Posted: 2007-08-16 04:50pm
by Dalton
Fails under IE6. Error on Line 47 Character 3 (Error: Object doesn't support this property or method.).
Succeeds using Safari for iPhone.
Posted: 2007-08-16 04:50pm
by chitoryu12
Fails using IE6. Java is indeed on and working fine for everything else.
Posted: 2007-08-16 05:16pm
by Darth Wong
I won't be the first web developer to say this, but goddammit, I hate fucking Internet Explorer.
The JavaScript source code is fully visible in the web page source. If anyone can offer any suggestions as to why it's not working on IE, I'd appreciate it.
Posted: 2007-08-16 05:25pm
by Darth Wong
Resinence wrote:As for the IE7 issue, confirmed.
Error output:
Code: Select all
Line 12
Char 3
Error: Object doesn't support this property or method.
Code 0
WTF? The only thing on line 12 of that file is a curly bracket. How does IE count line numbers?
Posted: 2007-08-16 05:39pm
by Socar15
When I checked the source in IE7, this is what it gave me for line 12:
Posted: 2007-08-16 05:50pm
by Dalton
Dunno, but the errors manifest when you hit the start or stop buttons on either function.
I think I see a problem, though...you have an undeclared variable (t1) in function roll1. I think you need to declare the variable as 0 beforehand. Also, might I suggest preloading the dice images?
EDIT: Got it! Mike, you forgot to declare dice1 and dice2 as variables. What I did is added this to the top:
Code: Select all
<SCRIPT type=text/javascript>
//<![CDATA[
var t1 = 0;
var t2 = 0;
Then I added this:
var dice1=new Array();
And then this:
var dice2=new Array();
Posted: 2007-08-16 06:10pm
by Dalton
Unfortunately that just broke it in Firefox. Stand by...
EDIT: I really hate the way IE does Javascript sometimes. I'm trying to figure out why it's throwing out all these undefined errors. I wonder if it has to do with you naming one of your HTML elements the same as one of your variables, or is that the idea here? Hm.
Posted: 2007-08-16 06:15pm
by Darth Wong
This is why I prefer PHP over JavaScript. Unfortunately, PHP wouldn't work at all for this particular application.
Posted: 2007-08-16 06:24pm
by Dalton
Darth Wong wrote:This is why I prefer PHP over JavaScript. Unfortunately, PHP wouldn't work at all for this particular application.
Mike, I think I fixed the problem. If you rename the DIV tag IDs you have from dice1 and dice2 to something else, then change the calls in the Javascript (getElementById), it works in both IE and Firefox.
Posted: 2007-08-16 06:25pm
by Starglider
I've rewritten it to work in IE, and also simplified it somewhat. I tried to stick to the original coding style. Whatever you're using to generate that HTML, it's pretty nasty.
http://www.bitphase.com/starglider/dice ... cience.htm
Posted: 2007-08-16 06:32pm
by Dalton
Good one. I just renamed the DIV IDs, which basically unconfused IE.
Posted: 2007-08-16 06:39pm
by Crown
That still works with Safari 2.0.4.
Posted: 2007-08-16 08:32pm
by chitoryu12
Posted: 2007-08-16 09:03pm
by EnsGabe
No regression for Opera 9.23/Linux or Konq 3.5.7 .
Posted: 2007-08-17 10:45am
by Darth Wong
Very nice. It seems to work, but I'm confused about exactly
why it works, to be honest. I'm just saying that because in the roll2() function, it tests sixes1 to see if it should stop rolling, and maybe I'm just clueless at programming but it seems to me like it should be testing sixes2.
Code: Select all
function roll2()
{
var roll=Math.floor(Math.random()*6)+1;
var die=document.getElementById("d2-"+(sixes2+1));
die.src='die'+roll+'.gif'; die.style.visibility = "visible";
if(roll==6) sixes2++;
rolls2++;
document.getElementById("count2").innerHTML=' # of rolls: '+rolls2;
if(sixes1==10)
{
clearTimeout(timer2);
}
else
{
timer2=setTimeout("roll2()",500);
}
}
The thing seems to work anyway, so I must be missing something.
PS. About the HTML, those lower-case tags and seemingly superfluous slashes in the input and img tags are actually required for XHTML Strict validation.