(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
06-03-24 01:02 AM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - Weird Javascript problem in IE New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6314 days
Last view: 6314 days
Posted on 11-19-05 08:44 AM Link | Quote
Well I wrote this rather extensive javascript app, and it works great in lololol, but when I decided to try it in IE, it of course does squat.
<script language="javascript">
InitHTTP(); //We need this to download the image list
if(!http) alert("Failed to initialize AJAX core.;);

var i; //Generic counter
var imglist = Download("imglist.txt","get",null); //Get the list
var images = imglist.split('\n'); //Break it up into an array
var imgheight = new Array(images.length); //We need the height of each image

var zoom = 1.0; //Zoom amount
var ss_timer; //Slideshow timer

var loadok = false; //Check if an image has loaded
var loadtime = 200; //How many ms to wait for an image
var loadattempts = 20; //How many times to try to load the image

var img = 0;
var mode = 0; //0=center 1=tile 2=stretch

//See what browser we're using
var ie = (navigator.userAgent.indexOf("MSIE;) >= 0);
if(!ie) document.captureEvents(Event.KEYPRESS);
document.onkeypress = KeyPress;

//Startup
function Init()
{
//Remove line breaks from images
for(i=0;i<images.length;i++)
images[i] = images[i].replace('\x0D',";);
[...]


The problem is that the variables defined at the beginning don't seem to be sticking around. Init() runs in the body's onload event, and IE complains that 'images' is null at this point.
neotransotaku

Sledge Brother
Liberated from school...until MLK day








Since: 11-17-05
From: In Hearst Field Annex...

Last post: 6316 days
Last view: 6314 days
Posted on 11-19-05 01:08 PM Link | Quote
I wonder if your AJAX is setup properly because IE AJAX is initialized differently than Mozilla AJAX.
Doppelganger

8DS








Since: 11-17-05
From: 65 00 20 00 65 00 1F 00 65 00 2F 00

Last post: 6314 days
Last view: 6314 days
Posted on 11-19-05 03:42 PM Link | Quote
Originally posted by neotransotaku
I wonder if your AJAX is setup properly because IE AJAX is initialized differently than Mozilla AJAX.


Wouldn't that be an internal problem?
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6314 days
Last view: 6314 days
Posted on 11-19-05 06:32 PM Link | Quote
Well if it wasn't, that alert should fire. It should work in both; it's designed to and I've used it in IE before. I tried adding alerts/document.writes just after the list is downloaded to see if they actually contained anything, but it wouldn't execute them.
Gavin

Cheep-cheep
Vandalism is not tolerated


 





Since: 11-17-05
From: IL, USA

Last post: 6391 days
Last view: 6334 days
Posted on 11-19-05 08:36 PM Link | Quote
I don't know how you expect to get help if you post the very top portion of code which makes references to functions we can't see . And I'm guessing those extra ";" are thrown in by a board parsing error and that you didn't forget to close strings on the alert and user agent checking.

Originally posted by neotransotaku
I wonder if your AJAX is setup properly because IE AJAX is initialized differently than Mozilla AJAX.


if he included code we could tell.

Originally posted by Dei
Originally posted by neotransotaku
I wonder if your AJAX is setup properly because IE AJAX is initialized differently than Mozilla AJAX.


Wouldn't that be an internal problem?


no.

Originally posted by HyperHacker
Well if it wasn't, that alert should fire. It should work in both; it's designed to and I've used it in IE before. I tried adding alerts/document.writes just after the list is downloaded to see if they actually contained anything, but it wouldn't execute them.


just taking a wild stab at the little amount of code you provded, I say the Download function is wrong . *Wonders if this will end up like 99% of the rest of HH's programming posts with his top posts being editing 3 times with him ultimetly finding the error himself and leaving everyone clueless and not caring*
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6314 days
Last view: 6314 days
Posted on 11-20-05 03:18 AM Link | Quote
Yeah, the board seems to have messed up a few places. I just finished everything except making it work in IE, so here's the code. (Works in lololol.) It's an image viewer, like the one in Windows XP. There's some big images there, but they don't load until you actually try to view them. (Although the rest of the code doesn't really have anything to do with the problem. )

Anyway I tried running the final version in IE. It says "object doesn't support this property or method" on line 64. Too bad line 64 is smack in the middle of a big long comment.

BTW, do whatever the hell you want with that code. I'd appreciate being credited for it though.

[edit] If you do use it, you might want to try to fix the stretching logic. Try it with images 6 or 7 to see what I mean. That'll teach me to use all similar-sized images in testing...


(edited by HyperHacker on 11-20-05 02:32 AM)
FreeDOS +

Giant Red Koopa
Legion: freedos = fritos








Since: 11-17-05
From: Seattle

Last post: 6314 days
Last view: 6314 days
Posted on 11-20-05 04:36 AM Link | Quote
It bugs up with ImageZoom... but I guess it should be the extension/browser's problem more than yours.

Also, this is completely explainable... especially if you just extracted it from a ZIP... it was created on your filesystem at that date, but it preserved the original modification date.
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6314 days
Last view: 6314 days
Posted on 11-20-05 05:05 AM Link | Quote
Argh, last time I tried to explain that, everybody kept assuming I was blind or something, but anyway, the modified date on that file was in 2004 when I copied it, but then changed to 2001 while I was editing it. I know because it was in a directory sorted by modifcation date, and after saving an edit, it jumped from near the end of the list to the beginning. Now enough about that off-topic topic.

BTW, I uploaded a new version. Now stretching works properly with any image, and images with apostrophes and/or spaces in their name show up in tiled mode. Since apparently people care specifically how I fix everything:

Proportional stretch was b0rked because if one dimension was a lot bigger than the other, the image would stretch the page. I fixed this by determining which dimension was bigger, stretching it to fill the page, then calculating how much to stretch the other dimension to maintain aspect ratio. If the result of this has the smaller dimension bigger than the available screen space, then do it the other way around. (You might think "what if the result of this still exceeds the available space?" - it doesn't, because the result has the bigger dimension smaller than it was before, and it was the size of the space before. If that makes any sense to anyone.)

Apostrophes and spaces were simple:
document.getElementById("image").style.backgroundImage = "url('" + images[img].replace("'","\\'") + "')";
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - Programming - Weird Javascript problem in IE |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.035 seconds; used 393.05 kB (max 483.66 kB)