Please test my JavaScript widget

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

User avatar
Darth Wong
Sith Lord
Sith Lord
Posts: 70028
Joined: 2002-07-03 12:25am
Location: Toronto, Canada
Contact:

Please test my JavaScript widget

Post 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.
Image
"It's not evil for God to do it. Or for someone to do it at God's command."- Jonathan Boyd on baby-killing

"you guys are fascinated with the use of those "rules of logic" to the extent that you don't really want to discussus anything."- GC

"I do not believe Russian Roulette is a stupid act" - Embracer of Darkness

"Viagra commercials appear to save lives" - tharkûn on US health care.

http://www.stardestroyer.net/Mike/RantMode/Blurbs.html
User avatar
Bounty
Emperor's Hand
Posts: 10767
Joined: 2005-01-20 08:33am
Location: Belgium

Post by Bounty »

Works fine in Opera 9.2 on Linux.
rhoenix
Jedi Council Member
Posts: 1910
Joined: 2006-04-22 07:52pm

Post 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.
User avatar
EnsGabe
Youngling
Posts: 54
Joined: 2006-07-10 09:49pm

Post by EnsGabe »

Bounty wrote:Works fine in Opera 9.2 on Linux.
Confirmed. (9.23/Linux)
The Monarch: "Anyone wanna explain to me why my coccoon is charred?"
24: "Because you told us to blow it up"
The Monarch: "And why it is sideways?"
21: "We were following orders! You can't yell at us for following orders."
24: "Or kill us for following orders."
User avatar
Crown
NARF
Posts: 10615
Joined: 2002-07-11 11:45am
Location: In Transit ...

Post 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! :P )
Image
Η ζωή, η ζωή εδω τελειώνει!
"Science is one cold-hearted bitch with a 14" strap-on" - Masuka 'Dexter'
"Angela is not the woman you think she is Gabriel, she's done terrible things"
"So have I, and I'm going to do them all to you." - Sylar to Arthur 'Heroes'
User avatar
Resinence
Jedi Knight
Posts: 847
Joined: 2006-05-06 08:00am
Location: Australia

Post by Resinence »

No problems in Safari 3.0.3
“Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation.” - Oscar Wilde.
User avatar
FSTargetDrone
Emperor's Hand
Posts: 7878
Joined: 2004-04-10 06:10pm
Location: Drone HQ, Pennsylvania, USA

Post 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?
Image
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Post 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.
User avatar
FSTargetDrone
Emperor's Hand
Posts: 7878
Joined: 2004-04-10 06:10pm
Location: Drone HQ, Pennsylvania, USA

Post 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.
Image
User avatar
Resinence
Jedi Knight
Posts: 847
Joined: 2006-05-06 08:00am
Location: Australia

Post 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
“Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation.” - Oscar Wilde.
User avatar
Dalton
For Those About to Rock We Salute You
For Those About to Rock We Salute You
Posts: 22637
Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:

Post 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.
Last edited by Dalton on 2007-08-16 05:01pm, edited 2 times in total.
Image
Image
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN

"y = mx + bro" - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster

May the way of the Hero lead to the Triforce.
User avatar
chitoryu12
Jedi Council Member
Posts: 1997
Joined: 2005-12-19 09:34pm
Location: Florida

Post by chitoryu12 »

Fails using IE6. Java is indeed on and working fine for everything else.
User avatar
Darth Wong
Sith Lord
Sith Lord
Posts: 70028
Joined: 2002-07-03 12:25am
Location: Toronto, Canada
Contact:

Post 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.
Image
"It's not evil for God to do it. Or for someone to do it at God's command."- Jonathan Boyd on baby-killing

"you guys are fascinated with the use of those "rules of logic" to the extent that you don't really want to discussus anything."- GC

"I do not believe Russian Roulette is a stupid act" - Embracer of Darkness

"Viagra commercials appear to save lives" - tharkûn on US health care.

http://www.stardestroyer.net/Mike/RantMode/Blurbs.html
User avatar
Darth Wong
Sith Lord
Sith Lord
Posts: 70028
Joined: 2002-07-03 12:25am
Location: Toronto, Canada
Contact:

Post 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?
Image
"It's not evil for God to do it. Or for someone to do it at God's command."- Jonathan Boyd on baby-killing

"you guys are fascinated with the use of those "rules of logic" to the extent that you don't really want to discussus anything."- GC

"I do not believe Russian Roulette is a stupid act" - Embracer of Darkness

"Viagra commercials appear to save lives" - tharkûn on US health care.

http://www.stardestroyer.net/Mike/RantMode/Blurbs.html
Socar15
Redshirt
Posts: 46
Joined: 2005-11-23 12:12am

Post by Socar15 »

When I checked the source in IE7, this is what it gave me for line 12:

Code: Select all

dice1=new Array();
User avatar
Dalton
For Those About to Rock We Salute You
For Those About to Rock We Salute You
Posts: 22637
Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:

Post 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();
Image
Image
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN

"y = mx + bro" - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster

May the way of the Hero lead to the Triforce.
User avatar
Dalton
For Those About to Rock We Salute You
For Those About to Rock We Salute You
Posts: 22637
Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:

Post 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.
Last edited by Dalton on 2007-08-16 06:17pm, edited 1 time in total.
Image
Image
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN

"y = mx + bro" - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster

May the way of the Hero lead to the Triforce.
User avatar
Darth Wong
Sith Lord
Sith Lord
Posts: 70028
Joined: 2002-07-03 12:25am
Location: Toronto, Canada
Contact:

Post by Darth Wong »

This is why I prefer PHP over JavaScript. Unfortunately, PHP wouldn't work at all for this particular application.
Image
"It's not evil for God to do it. Or for someone to do it at God's command."- Jonathan Boyd on baby-killing

"you guys are fascinated with the use of those "rules of logic" to the extent that you don't really want to discussus anything."- GC

"I do not believe Russian Roulette is a stupid act" - Embracer of Darkness

"Viagra commercials appear to save lives" - tharkûn on US health care.

http://www.stardestroyer.net/Mike/RantMode/Blurbs.html
User avatar
Dalton
For Those About to Rock We Salute You
For Those About to Rock We Salute You
Posts: 22637
Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:

Post 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.
Image
Image
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN

"y = mx + bro" - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster

May the way of the Hero lead to the Triforce.
User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Post 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
User avatar
Dalton
For Those About to Rock We Salute You
For Those About to Rock We Salute You
Posts: 22637
Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:

Post by Dalton »

Starglider wrote: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
Good one. I just renamed the DIV IDs, which basically unconfused IE.
Image
Image
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN

"y = mx + bro" - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster

May the way of the Hero lead to the Triforce.
User avatar
Crown
NARF
Posts: 10615
Joined: 2002-07-11 11:45am
Location: In Transit ...

Post by Crown »

Starglider wrote: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
That still works with Safari 2.0.4.
Image
Η ζωή, η ζωή εδω τελειώνει!
"Science is one cold-hearted bitch with a 14" strap-on" - Masuka 'Dexter'
"Angela is not the woman you think she is Gabriel, she's done terrible things"
"So have I, and I'm going to do them all to you." - Sylar to Arthur 'Heroes'
User avatar
chitoryu12
Jedi Council Member
Posts: 1997
Joined: 2005-12-19 09:34pm
Location: Florida

Post by chitoryu12 »

Starglider wrote: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
Yep. Works perfectly.
User avatar
EnsGabe
Youngling
Posts: 54
Joined: 2006-07-10 09:49pm

Post by EnsGabe »

Starglider wrote: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
No regression for Opera 9.23/Linux or Konq 3.5.7 .
The Monarch: "Anyone wanna explain to me why my coccoon is charred?"
24: "Because you told us to blow it up"
The Monarch: "And why it is sideways?"
21: "We were following orders! You can't yell at us for following orders."
24: "Or kill us for following orders."
User avatar
Darth Wong
Sith Lord
Sith Lord
Posts: 70028
Joined: 2002-07-03 12:25am
Location: Toronto, Canada
Contact:

Post by Darth Wong »

Starglider wrote: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
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.
Image
"It's not evil for God to do it. Or for someone to do it at God's command."- Jonathan Boyd on baby-killing

"you guys are fascinated with the use of those "rules of logic" to the extent that you don't really want to discussus anything."- GC

"I do not believe Russian Roulette is a stupid act" - Embracer of Darkness

"Viagra commercials appear to save lives" - tharkûn on US health care.

http://www.stardestroyer.net/Mike/RantMode/Blurbs.html
Post Reply