I am trying to get this to work
http://www.5ylac.s5.com/puzzle/
I copied the code from
http://www.webreference.com/dhtml/column8/
but theres work s and mine doesnt
want am i doing wrong ?
Filmmaker, gentleman and pearls before swine fan
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » Developers, developers, developers » Web design and development » DHTML Puzzle Problems :-(
I am trying to get this to work
http://www.5ylac.s5.com/puzzle/
I copied the code from
http://www.webreference.com/dhtml/column8/
but theres work s and mine doesnt
want am i doing wrong ?
Filmmaker, gentleman and pearls before swine fan
This is complicated! What about it doesn’t work?
(I did find one piece that “locked in” to position and couldn’t be moved. Not sure if that is good or bad.)
By the way, you make a URL live here with before and after. Like this: http://www.5ylac.s5.com/puzzle/%5B/url%5D.
This is complicated! What about it doesn’t work?
(I did find one piece that “locked in” to position and couldn’t be moved. Not sure if that is good or bad.)
By the way, you make a URL live here with before and after. Like this: http://www.5ylac.s5.com/puzzle/%5B/url%5D.
This is some interesting script. I’ve never used rectangular clipping before, and it gives me some ideas for how to “reveal” a photo on an album page… but back to your puzzle.
I redid the puzzle and this time 6 pieces were “missing.” Using the IE5 developer accessories’ Document Tree, I determined that the “top” of one of the missing pieces was at -207 pixels, which obviously is hard to see on a normal monitor. This suggests that there’s a problem with the “randomizer” routine which breaks up the puzzle and plops the pieces all over the screen. Thinking it might help to maximize the screen, I refreshed it again and, without trying to solve it, checked the first few pieces. #3 had a top position of -110 pixels. Okay, we have a math problem.
Because the JPG file is taller than the area of the viewable browser window, the normally expected “end-of-range” value for the randomizing process is negative (at least on my display; your display may differ). The function that generates the top position of the piece uses this code:
temp = parseInt((Math.random() * (to-from)) + (from));
Because to is a negative number, this can return a value that is offscreen. You might edit the expression that creates the to value:
endT = (startT + document.body.offsetHeight) – puzzHeight;
![]() |
While body.offsetHeight isn’t listed, I assume it’s the full vertical area of white and light blue. So… that seems correct. This means that something needs to be added to the document itself to ensure that the body element has a height greater than the height of the JPG.
Upon further study, it appears that the grid.gif should be made to match the size of the JPG. This possibly could be done in script by setting its width and height attributes, but this would have to be done early enough that the offsetHeight of the body was calculated correctly. Otherwise, of course, it could be done by creating a new grid.gif that fit your JPG. [After testing] Well, that didn’t seem to work. Maybe ask the script’s authors what they suggest.
This is some interesting script. I’ve never used rectangular clipping before, and it gives me some ideas for how to “reveal” a photo on an album page… but back to your puzzle.
I redid the puzzle and this time 6 pieces were “missing.” Using the IE5 developer accessories’ Document Tree, I determined that the “top” of one of the missing pieces was at -207 pixels, which obviously is hard to see on a normal monitor. This suggests that there’s a problem with the “randomizer” routine which breaks up the puzzle and plops the pieces all over the screen. Thinking it might help to maximize the screen, I refreshed it again and, without trying to solve it, checked the first few pieces. #3 had a top position of -110 pixels. Okay, we have a math problem.
Because the JPG file is taller than the area of the viewable browser window, the normally expected “end-of-range” value for the randomizing process is negative (at least on my display; your display may differ). The function that generates the top position of the piece uses this code:
temp = parseInt((Math.random() * (to-from)) + (from));
Because to is a negative number, this can return a value that is offscreen. You might edit the expression that creates the to value:
endT = (startT + document.body.offsetHeight) – puzzHeight;
![]() |
While body.offsetHeight isn’t listed, I assume it’s the full vertical area of white and light blue. So… that seems correct. This means that something needs to be added to the document itself to ensure that the body element has a height greater than the height of the JPG.
Upon further study, it appears that the grid.gif should be made to match the size of the JPG. This possibly could be done in script by setting its width and height attributes, but this would have to be done early enough that the offsetHeight of the body was calculated correctly. Otherwise, of course, it could be done by creating a new grid.gif that fit your JPG. [After testing] Well, that didn’t seem to work. Maybe ask the script’s authors what they suggest.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications