JavaScript - Loading External Javascript Images Within Container
Greetings,
I am looking for either a JavaScript or Coldfusion solution to the following problem. First, there are over 60 million product photos so downloading and resizing the photos using Coldfusion would be very tedious. I would like the display an image within a 100 x 100 pixel container. If the height or width of the image is great than 100 pixels, the image should reduce in size to fit within the 100 x 100 pixel container. I want to avoid pixelation of the images as much as possible. All images are external and not on the local server so I only have an image URL. I would like to hide all images until they are resized appropriately. Does anybody know of a piece of javascript code that can do something similar to this? Sincerely, Travis Walters Similar TutorialsI have an external Javascript file that only works when I put: Code: <script type="text/javascript" src="external.js"></script> at the end of the HTML page. Does anyone know why it won't work in the head of the page? Thanks As a homework assignment, we are being asked to generate a table of images with at least 2 rows and 3 columns from an external javascript function. I've been trying to find some kind of javascript reference for this and I can't. I don't want someone to do it for me, but if I could get a basic example that would be great.
Hello, I have develop a piece of code that when the user loads the html page it will load a local image but if the image doesn't exist it will load from a remote server. The question that remains is if it's possible to make an event in case the image is load locally? 1) HTML Page is load 2) If image doesn't exist locally reload from the server 3) If the image is load locally report back to the site Is the 3) possible? Hello, I was wondering if it is possible to load external pages (from a different server) into a lightbox, without using a iframe. Any solutions for this? Thanks a lot in advance! Kind regards, Robbert So, I have to rely on a third party external JS file to load into a site of mine. Problem is I have to have it (for ads), but once every blue moon the server fails to repond to the request (its down or unresponsive), and thus because the JS can't load, the site hangs. Is there a reliable js/ajax etc.. mechanism that I can use to set an allotted time and if the js isn't loaded, cancel the call or stop it so the page can load? Please advise. Caveats: I cannot host it, I cannot use php. Basically I was given a script call and I include it in the header of the page. I don't have alot of room to host, use various technologies etc.. other than what I am able to use without any backend/app scripting. Hi I am currently doing a photography site. I would like to do a 'portfolio' page, but would like to pre-load the images so that they appear on-screen faster. Do I need to connect code to <body onload>? is there a way to after thye page load add an image. So maby loading it in the background and just showing it when you click a button?
I have some rollover images on my website, and they don't switch until the page is finished loading. Is this standard? Is there a way to have the rollovers work when the page is still in the process of loading all the images? Thanks Hello. My goal is to load the JS for a specific element before displaying that element. I integrated a third part script, and it works well. I set the timer he The JS is in my heading as <script type="text/javascript" src="countdownpro.js"></script> About mid-body I have: <span id="countdown1">2010-07-20 00:00:00 GMT+00:00</span> which allows for the setting of a target date to countdown to. When the page first loads it shows the above long format target time, until the js/meta tags kick in to modify it to just show the actual countdown as 00:00:00. I have attached countdownpro.js to this post. I tried shifting the function CD_Init() to the top of the script, and also appended it inline with the .html. I tried setting the big external script to "defer", but neither arrangement worked. I also tried placing the src file right at the top. I appreciate your help. Hi Currently my website waits till all images are loaded up first: Code: $(document).ready(function(){ * LOAD UP ALL THEM IMAGES FIRST... * $(window).load(function() { letsLoad(); fadingEffects(); }); However my website now has over 200 images on the website and now its taking way too long to load the images. My question's a 1. Is it possible to either load the site when its around 20% or even 50% loaded? OR 2. If its possible to give certain images a tag?? and when these images are loaded then the site loads? Heres a link to the site - must warn you need broadband and a high speed connection takes way to long to load. Takes me around 1minute 30seconds http://www.arcvizio.co.uk/ovoma/2/index.html Thanks Hello. I've recently implemented this really cool jQuery preloader called queryLoader. When a visitor comes to my site they are fed all the important images for the entire site (it's a very small site). During that time queryLoader shows a percentage loading animation, and once all the images are loaded it wipes the screen & displays the website. I've placed another custom animation in the "page loading" div, and i want to make sure it loads first so that it is displayed while the rest of the images get downloaded. I've tried pre-loading with javascript as the very first script in my header, before jQuery or queryLoader get loaded, like this: Code: <script type="text/javascript"> pic1= new Image(250,300); pic1.src="images/page_loading.gif"; </script> <script type="text/javascript" src="scripts/jQuery.js"></script> <script type="text/javascript" src="scripts/queryLoader.js"></script> However, this doesn't seem to be that effective. When i clear browser cache and reload the page, the page_loading.gif sometimes doesn't appear until the site is almost completely loaded. Is there a more effective way to assure the page_loading.gif gets loaded before any other images? My site is jugtones.com if that helps in any way. Thanks for your time, -Scott Code: <html> <head> <title>test</title> </head> <body> <script language = "javaScript"> var clouds = []; var i = 0; while(i <= 5) { var cld = new Image(); cld.onload = function() { clouds.push(cld); } cld.src = "cloud.png"; i++; } document.write(clouds.length); </script> </body> </html> Where am I messing up clouds.length returns 0. Why? I know this is simple, but it will get more complex. I can search for the code, but I would like feedback as to what I'm doing wrong. This is more than likely going to be a multi stage question. More to come... ------ Also, I would like to say that this is my first post. Thanks in advance to those who reply. <body> <script type="text/javascript" src="/khk.php?klub=khk&user=w"></script> This script works fine, but I get a error: line: 2 character: 1 error: character illegal code: 0 url .... Can anybody help?? hello, I have designed a web site. but I want to protect my external javascript(and css also) from outside people, who steal my javascript. can anyone tell me a method to hide external javascript(and css) from these knaves...!!! thank you Hi, I've posted a previous thread where the code I had wasn't running. I copied that into the head section and it worked. I'd like to know why it doesn't work in the javascript.js file. Thank you very much. Dear All, I got a problem with order of loading external javascript file. I have 2 external javascript files: jsFile1. js and jsFile2.js. And file jsFile2 use an object in file jsFile1.js. So file jsFile2.js have to load after file jsFile1.js. But sometime I got runtime error, because file jsFile2.js is loaded before jsFile1.js I added 2 js files by: document.getElementsByTagName('head')[0].appendChild(jsFile1.js); document.getElementsByTagName('head')[0].appendChild(jsFile2.js); Does anyone know how to solve this problem. Please help. Thank you. Best Regards. Hi all me again I have this bit of code: Code: <script type="text/javascript"> var testvar = "<? print $cards; ?>"; var name = "<? print $name; ?>"; //Create JavaScript array var testarray = new Array(); //Fill JavaScript array from the converted string testarray = testvar.split(":#:"); var imagesleft = 10; var numclicks = 0; var score = 0; function clickCard (what,where) { var count=0; for(var x = 0; x < testarray.length; x++) { if(what == testarray[x]) { count++; } } if(count==1) { alert("unique"); document.images[where].src = "./images/blank.png"; imagesleft--; score = score+20; clicks.innerHTML = "Unique Images to find = " + imagesleft; if(imagesleft==0) { score = score - numclicks; var r=confirm("Do you want to enter your score in the highscore table?"); if (r==true) { document.getElementById('score').value = score; document.forms["highscore"].submit(); } else { var t=confirm("Do you want to play again?"); if (t==true) { document.location.reload(); } else { window.close(); } } } } else { alert("Not unique"); } numclicks++; pairs.innerHTML = "Number of Clicks = " + numclicks; } </script> which works a treat but when it is put into a external js file all I get is the alert Not unique and nothing else! any ideas why? Hi Guys, I am tiring to create an external java script which is suppose to change a div background color when mouse over. I have a simple Html file as: Code: <html> <head> <script type="text/javascript" src="MouseJs.js"></script> <link rel="stylesheet" type="text/css" href="MouseCSS.css"> <title>Test Mouse Over</title> </head> <body> <div class="box" id="col"> </div> </body> </html> and a CSS file as: Code: .box { width: 20%; height: 100px; background-color: #4D7530; float:left; } and finally I have a java script file as bellow: Code: window.onload = function() { document.getElementById('col').onmouseover = function() { document.col.background-color: #FFFFFF; } } Could you please let me know what i am doing wrong here? Thanks Hi, is it possible to make a external javascript link by giving all the external links a class name then use getelementbytagname in the js file with a function to alert the hes leaving the website and let him choose if he wants to stay or leave. well thats what im trying to do but i dont know how to write the function for it maybe i could get a suggestion or a link to agood tutorial. / thanks lisa Hi, im having a problem adding a frame busting killer that counteracts a frame killer script on sites so i can load them inside my iframes.. here is the code i use <?php $result = mysql_query("SELECT ru.id, ru.username, ru.owid FROM raidbar_users ru LEFT JOIN raidbar_groups rg ON ru.groupid = rg.id WHERE rg.id = '".(int)$_REQUEST['group']."'") or die(mysql_error()); $myRaidid = raidid(); if(isset($_GET['gm'])) { echo '<FRAMESET rows="*,*,*,30" frameborder="0">' . "\n"; echo ' <FRAMESET cols="*,*" frameborder="0" scrolling="no">' . "\n"; $i = 0; while($row = mysql_fetch_array($result)) { if ($i == 2) { echo ' </FRAMESET>' . "\n"; echo ' <FRAMESET cols="*,*" frameborder="0" scrolling="no">' . "\n"; $i = 0; } echo ' <FRAME src="http://'.$server[$siteConfig['userServer']].'.***********/joinraid.php?raidid=' . $myRaidid . '&suid=' . $row['owid'] . '&serverid='.$siteConfig['userServer'].'">' . "\n"; $i++; } echo ' <FRAME src="">' . "\n"; echo ' </FRAMESET>' . "\n"; echo ' <FRAMESET frameborder="0" scrolling="no">' . "\n"; echo ' <FRAME src="http://'.$server[$siteConfig['userServer']].'.***********/raidmembers.php?raidid=' . $myRaidid . '">' . "\n"; echo ' </FRAMESET>' . "\n"; echo '</FRAMESET>' . "\n"; } else { echo '<table cellspacing=1 cellpadding=1>' . "\n"; echo '<tr>' . "\n"; $i = 0; while($row = mysql_fetch_array($result)) { if ($i == 2) { echo '</tr>' . "\n"; echo '<tr>' . "\n"; $i = 0; } echo ' <td><iframe src="./acct.php?suid=' . $row['owid'] . '" width=450 height=225 scrolling=no frameborder=0></iframe>' . "\n"; $i++; } echo '</tr>' . "\n"; echo '<tr>' . "\n"; echo ' <td><iframe src=http://'.$server[$siteConfig['userServer']].'.***********/raidmembers.php?raidid=' . raidid() . '&serverid='.$siteConfig['userServer'].' width=250 height=30 scrolling=no></iframe>' . "\n"; echo '</tr>' . "\n"; echo '</table>' . "\n"; } ?> Now im told to use the following.. <script type="text/javascript"> var prevent_bust = 0 window.onbeforeunload = function() { prevent_bust++ } setInterval(function() { if (prevent_bust > 0) { prevent_bust -= 2 window.top.location = 'http://server-which-responds-with-204.com' } }, 1) </script> or var prevent_bust = 0; // Event handler to catch execution of the busting script. window.onbeforeunload = function() { prevent_bust++ }; // Continuously monitor whether busting script has fired. setInterval(function() { if (prevent_bust > 0) { // Yes: it has fired. prevent_bust -= 2; // Avoid further action. // Get a 'No Content' status which keeps us on the same page. window.top.location = 'http://server-which-responds-with-204.com'; } }, 1); But the window.top.location i dont know how to incorporate that to work. Can anyone help? |