Preloaded Image Won't Display
May 19, 2006
I'm working on a web map, in which you click on a building to open a pop-up with a photo of that building in the window. Rather than use a generic pop-up, I've styled it to look similar to the parent page. Since my map contains over 200 buildings, initially this meant creating over 200 separate html pages with the image source and dimensions for each building photo. That's clearly very inefficient and not a process I want to duplicate! Therefore, I needed some dynamic code to generate the content in the pop-up.
I successfully used a cookie to pass a building ID variable to the pop-up and use that to grab the associated photo from a directory and that worked fine. However, I ran into problems because the photos are not identical in size, and I also needed to get the image width and height. I tried preloading the image using a standard image caching script and used that to obtain the width and height of the image. Then, I used document.write to place those variable in the <img> tag and place the photo on the page.
The problem is that the cached image will not display on the page when it loads, only if I hit refresh. Can anyone tell me how to get around this? Here's the code I'm using. I call this function inside a <p> tag in the body of the page:
if (document.images) {
bldg = new Image();
bldg.src = "../../Columbia/bl/bl_" + BldgId + ".jpg";
theWidth = bldg.width;
theHeight = bldg.height; }
function showImage() {
var photoSrc = "<img src='../../Columbia/bl/bl_" + BldgId + ".jpg'";
var insertPhoto = photoSrc + " width='" + theWidth + "px' height='" + theHeight + "px' alt='" + BldgId + " Photo not available' />";
document.write(insertPhoto);}
Is there another way to get the image's dimensions BEFORE I place it on the page?
View 8 Replies
ADVERTISEMENT
Dec 19, 2010
I'm trying to build a slideshow page in Javascript. It's dynamically built and all of that is working, but the Javascript timing is giving me trouble. First, a PHP script builds an array of Image objects to preloads. I have a 'Loading pictures....' message appear in the foreground of the page. This message should disappear after the final image has been preloaded.
I'm using Javascript's onLoad() event of the last image to change the message's CSS div display property to hidden, but it always executes immediately, even though the browser is obviously still working. Is there a way just to tell Javascript "do not proceed with the rest of the code until this task has finished"?
View 2 Replies
View Related
Mar 7, 2011
I have been following a tutorial for an image gallery, i can upload images and use gd to create thumbnails that when clicked display the full sized image, but the full sized image is to big to fit in my design, i have managed to get the rel="lightbox" attached to the thumbnails as they are displayed but it wont load the full image, the loading ring just keeps going round, does anybody know how to fix this? is it even possible.
View 4 Replies
View Related
Apr 22, 2006
In my website I constructed a script that changes the image.sources of several images. The changes are made by calling a JS-function. The function is invoked by selecting an option in an html-form. In my second post below I pasted the code.
The problem is that each time the images are changed the browser starts to load them all again, although all images were PRELOADED in the <head> section of my HTML page. It takes time every time a user invokes image changings, and also the visual effects are worsened.
How can I prevent the browser from loading the images again each time?
View 1 Replies
View Related
Aug 5, 2011
I ended up having to preset style with JavaScript.
Here is what I did.
CSS Code:
JavaScript Code:
HTML4Strict Code:
The first time I hit toggle, nothing happens. The second time I hit toggle, the hidden list appears, but only because I used JavaScript to set the display property.
My workaround is to do this in the HTML after the element to be toggled.
JavaScript Code:
Putting this code in the elements onload event property didn't work either, which I found odd, but I read that it was not the recommended way of doing this.
I can't figure out why the CSS declaration didn't load into the JavaScript HTML DOM. I suspect it's some sort of order of execution thing, like the difference between the two following function declarations.
JavaScript Code:
View 2 Replies
View Related
Mar 30, 2011
I have a script one of my pages which is designed to prevent a user from selecting the same option from a drop down more than once. Here is the script:
Code:
function changeSelect(sel) {
option = sel.selctedIndex;
var sels=document.getElementsByTagName("select");
[Code]....
Here is the basis: A user is greeted with a page of blank fields. On the right is a drop down menu which has the select options you see. The user enters the address of a few DNS servers, then selects their main and least favorite DNS of the group. If there is a "Main DNS" already selected, it will blank the originally selected drop down, and fill in the newly selected drop down.
The problem I'm having, is when the user calls their settings back, the PHP will load the proper "main" and "last" options, but I have to select two more to get it to blank. I know this is because the script is called with an "onchange" function, but I've tried using "onLoads" and I've also tried making a quick function to "select" the option, but to no avail.
View 1 Replies
View Related
May 13, 2009
So, if a user clicks a button, I set a function to create a new class like:
When I click the button, nothing happens. I also used $ (".new_button").addClass functionalitiy to test it..
View 1 Replies
View Related
Mar 23, 2010
I hired a programmer to develop a drag and drop system for my blog. The user should be able to browse one of my blog entries and click, drag and drop an image from my entry to a fixed bottom bar on that page.The problem we are facing is that when dragging an image, it wont place it on the bottom bar until the whole page is scrolled down to the bottom of the page. This is a problem because some of the pages can be very lengthy
View 2 Replies
View Related
May 11, 2010
Using a UI dialog I'd like to load in 10 or so images. Each would be unique and after you click on one the following needs to happen:
1. Image appears on the parent page in a specified ID.
2. A "hidden" field is updated so that when the user submits the db is updated with their selection.
3. Dialog closes automatically.
That's it. Basically it would work similar to "datepicker".I'm using the latest 1.4 and ui and been making great progress as learning basics. I need to do the above and it seems like such a no brainier and or it should already exist but after 2 days of searching and trial and error...
View 6 Replies
View Related
Jan 14, 2011
How to display loading gif image until the big image have loaded? Now I have the html and js but it doesn't work. Anyone have some idea or solution ?
[Code]...
View 1 Replies
View Related
May 22, 2011
i am using ajax to retrieve the img url path how am i going to use the img url path i retrieve and display as a image and i using javascript language anyone know? how to do that i try the follow way but don't work what wrong?
Code:
var descIg = "";
descIg += rssent[i].descImg;
var placeImg = document.createElement('img');
placeImg.src = descIg;
View 24 Replies
View Related
Jul 12, 2010
I want to create something similar to what they achieve with this script:[URL] I know I could just download their script, but it's for a website that will be commercial in nature, and my cousin doesn't want to pay 29 pounds (which is a lot in AUD!) for it. I can use a rollover to display a larger image next to it, but I'm not sure on how to make the image move like that one does.
View 5 Replies
View Related
Nov 4, 2010
I created a forloop and that runs fine, but it wont run any code after the loop finishes.I've tryed playing around with it but nothing I do will make it display the alert. Heres the problem code:
function price()
{
var price=0;[code]....
View 10 Replies
View Related
Feb 14, 2010
I made a little app/page to help me count the money when Im done my shift at work. It runs fine in IExplorer, but it wont run in Firefox.
<html>
<head>
<title>Money Calculator 1.0</title>
[code]....
View 4 Replies
View Related
Nov 14, 2009
I have a CMS system using Tinymce and after making some alterations noticed the updates weren't showing up.After much messing (sql, set up etc) I started to delete the content bits at a time and came to the conclusion that is was the character
View 1 Replies
View Related
Feb 7, 2011
My function the_magnitude() takes in values from 4 different asp:textboxes. The textboxes "easting" and "northing" contain numbers that don't change, but the textboxes "east" and "north" contain numbers inputed by the user, and the function returns "error" as a value to be put into another textbox that we'll call "error box". So what it's suppose to do is when I update the information in either "east" or"north" it will update, on change, the number in the "error box". It kinda works.My problem is that if the number is a value that changes the style to red, #ff0000,in the function it wont update the "error box" and it just leaves a red zero that is a default number in the box. The only way I can get the number to change is if I end up with a number less than 200, which would make the text green.I'm pretty sure it's a problem with my javascript.here is my function
<script type="text/javascript">
function the_magnitude(easting, east, northing, north, error) {
var a = easting.value;
[code]....
View 2 Replies
View Related
Sep 16, 2010
i created a javascript for opening a page on a new window and added it on an html file. i then used the said html file as the source of my iframe on a joomla page. but the javascript isnt working. the said iframe is called Scroll News on this page: [URL]..
View 2 Replies
View Related
Jul 7, 2011
Ok, I have a student form which will be filled by operator.I want a small image to be displayed in a frame in the form when the operator brows the image each time he/she fill new student form.
View 1 Replies
View Related
Mar 26, 2001
Can anyone point me in the direction of a script that will show an image for, let's say, two days and then after that time show another image? I have one which will change images every day of the week but I'm looking for something where the original image never appears again. Possible?
View 1 Replies
View Related
Dec 4, 2011
We have one website [URL] it will open in only IE not in any other browsers. When it will open in other browsers it will shows source code. I have to make changes in it so that it will open in all the browsers.
View 18 Replies
View Related
Feb 19, 2009
have a function which finds the highest value of an array and im trying to get it to work on 2 arrays.however I dont really know how to do this so the function works fine on the first array but when i try to make it work on the second one it returns the same value as the first array, even though the second array shouldnt contain that value. I have put the code below, the funtion I am working on is findHighestValueIndex and the arrays I need it to work on are highestScoreIndex and highestWeightedScoreIndex.with the thank user button
<HTML>
<HEAD>
<TITLE>
[code]...
View 4 Replies
View Related
Sep 23, 2009
Im writing a piece of javascript that dynamically adds a link to a page, this is the code i'm using
var newP;
newP = document.createElement("a");
newP.innerHTML = "Click here";[code].........
However, it wont work?!?! the link appears in the right place on the page when i remove the line newP.setAttribute("href","http:[url]......);and if i view the source the link is <a>Click here</a> (without any href) so there's got to be something wrong with that line but i don't know what it is.I'm using firefox.
View 2 Replies
View Related
Mar 2, 2010
Ok my menuBarContainer div wont change width or height... I've tried everything... whats stopping it?
[url]
View 4 Replies
View Related
Dec 2, 2010
1 - the pics wont show in the slideshow. Only the text follows through to the next window. Why?2 - when you click the button "markera alla bilder" (mark all pics) only half of the pics get checked. why?Heres the code:
/.../
<script type="text/javascript" language="javascript">
var checked = new Array();
[code]....
View 5 Replies
View Related
Mar 21, 2011
What is wrong with my code?
I am trying to move a div and it wont work at all.
Also my little <a> fix is really sloppy.
<html>
View 2 Replies
View Related
Apr 5, 2011
I can get both to work separately. If Iput the slideshow below the menu bar in the body it does not play if I put the slideshow first the menu bar does not appear.
View 1 Replies
View Related