Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by duncan_cowan

  1. Thanks, I think it may work if I just prevent javascript from being reloaded. Or I may just use http requests to reload content that will change, such as the contents of the table, as opposed to the whole content. Thanks very much for the help
  2. To be honest there's way too much code for me to post it all, however:The bit that loads the content: $("#mid_content").load(link,parameters); And this may load a page that includes this script: <script type="text/javascript">$("#<?php echo $row_unit['id']; ?>_tbody").children().hover(function() { $("#<?php echo $row_unit['id']; ?>_details").stop().animate({height:35});}, function() { $("#<?php echo $row_unit['id']; ?>_details").stop().animate({height:0});});</script> Which works fine the first time, however changing the content overwrites the previous content. And after loading many different pages of content the page gets slower and slower, and if I look in the browser javascript diagnostics it shows numerous blocks of script that seem to have built up. One method I think would work would be to allow the loaded content to be cached, however any changes wouldn't be shown until a page refresh which isn't good for a dynamic site! Thanks.
  3. Hi, I am currently rewriting the user interface of my site in JQuery and making the pages dynamic so that no page loads are required as the content is loaded using HttpRequests through JQuery's .load() function. This is working well, however often the content will contain some javascript code blocks relevant to that specific page. Everytime the content is loaded through JQuery, the blocks are added to the cache, even if the content has already been loaded. Therefore after navigating around the site for a while, the javascript processing gets slower and slower, presumably due to the increase in the amount of script loaded. Is there any way around this problem? Such as by clearing the script cache? Or naming my script blocks so the page knows that it has already been loaded? Thanks for reading.Duncan
  4. Hi, sorry my mistake. after some more testing it turns out it is not a problem with the function but one with setting a variable.The variable is first set: var status = "wait"; Then inside a function it is changed: function beginAni() { status = "fade"; document.getElementById("block1").style.display = ''; introFade('block1');} However, the time it is changed is not working for some reason. Any ideas?Thanks
  5. Hi, i have a function that fades elements, however i am trying to get it to work with IE9 but it doesnt seem to recognise when the element has fully faded.This may be a problem with the beta, but i think my function may need changing...Function var TimeToFade = 1000.0;function introFade(eid){ var element = document.getElementById(eid); if(element == null) return; if(element.FadeState == null) { if(element.style.opacity == null || element.style.opacity == '' || element.style.opacity == '1') { element.FadeState = 2; } else { element.FadeState = -2; } } if(element.FadeState == 1 || element.FadeState == -1) { element.FadeState = element.FadeState == 1 ? -1 : 1; element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft; } else { element.FadeState = element.FadeState == 2 ? -1 : 1; element.FadeTimeLeft = TimeToFade; setTimeout("animateIntroFade(" + new Date().getTime() + ",'" + eid + "')", 33); }}function animateIntroFade(lastTick, eid){ var curTick = new Date().getTime(); var elapsedTicks = curTick - lastTick; var element = document.getElementById(eid); if(element.FadeTimeLeft <= elapsedTicks) { element.style.opacity = element.FadeState == 1 ? '1' : '0'; element.style.filter = 'alpha(opacity = ' + (element.FadeState == 1 ? '100' : '0') + ')'; element.FadeState = element.FadeState == 1 ? 2 : -2; if (element.FadeState == 2 && status == 'fade') { //if just faded in if (curBox<3) { curBox += 1; document.getElementById('block'+curBox).style.display = ''; setTimeout("introFade('block"+curBox+"')",500); } else if (curBox == 3) { setTimeout("introFade('block1')",400); setTimeout("introFade('block2')",400); setTimeout("introFade('block3')",400); document.getElementById("block4").style.display = ''; curBox += 1; setTimeout("introFade('block4')",1400); } else if (curBox == 4) { document.getElementById("block5").style.display = ''; curBox += 1; setTimeout("introFade('block5')",400); } else { status = 'end'; setTimeout("introFade('intro')",2000); } } else if (element.FadeState == -2 && status == 'fade') { //if just faded out element.style.display = 'none'; } else if (status == 'end') { //if finished document.getElementById('intro').style.display = "none"; beginHomeFade(); } return; } element.FadeTimeLeft -= elapsedTicks; var newOpVal = element.FadeTimeLeft/TimeToFade; if(element.FadeState == 1) newOpVal = 1 - newOpVal; element.style.opacity = newOpVal; element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')'; setTimeout("animateIntroFade(" + curTick + ",'" + eid + "')", 33);} I have tried myself however this function was not written by me and so i am not sure of some of the opacity parts.The function in use is on this page: www.coscom-pcs.co.uk/test(its in the stripy box)ThanksDuncan
  6. How are you trying to do it?With style you can probably make it work: E<b>xam</b><u style="font-weight:bold">ple</u><u> Tex</u>t
  7. It might just be simpler to use:str_replace("'", "", $file_name);Instead, I find preg_replace quite confusing sometimes...
  8. http://www.thedesignworld.com/articles/web...-to-the-iframe/This tutorial shows how to make a div have a slider, however the tutorial is for vertical sliding, but im sure it would not be hard to change the code a little for a horizontal slider.
  9. Hi,here is what i think you should have: function TestDataCheck(){var name = document.getElementById('frm').contact.value;var email = document.getElementById('frm').email.value;var phone = document.getElementById('frm').phone1.value;var course = document.getElementById('frm').course2.value; I think this may work however it may not, if not then try: function TestDataCheck(){var name = document.getElementById(contact).value;var email = document.getElementById(email).value;var phone = document.getElementById(phone1).value;var course = document.getElementById(course2).value;
  10. I believe that the main reason for iframes to be classed as bad is due to the way content included in them cannot be seen by search engine spiders and therefore can comprimise search engine optimism, however as your iframe only includes pictures i think that it is fine for you to use it.However an alternative method if you want to get rid of your iframe would be to use ajax.Hope this helps.
  11. htmlspecialchars is a php function which converts special html characters such as quotes and the '&' sign into their html codes such as '&'this prevents text inputed from a website user from being outputted as code by the webpage.also the:}else {echo "Where is no profile here"}as you can see from the 'else' is what will happen when no id is set in the url ($_GET['id'])ie. 'Where is no profile here' is outputted onto the pageI have a feeling this should be 'There is no profile here' however i may be mistaken and is up to you.
  12. I recommend google for this question:http://www.google.co.uk/search?hl=en&q...tiple+files+phpplus for the image path you will have to get the upload path, the name of the file and the type of file and put them together. I am not very good with uploading files but again there is alot of content on google about this topic.Hope i have helped.
  13. I agree that your way is better as i find that it is easier to identify which code is ran in which outcome, especially as my editor program highlights brackets around code.
  14. you need to either have web hosting or a localhost server, there are many free webhosting servers avaliable online (just make sure they support php) and you can upload your web files to the web and look at them online. Alternativley you could use a localhost server, i recommend 'xampp' which contains apache, phpmyadmin, php, a mail client, ftp software and more, however there are many other packages which include the same or similar contents.Similarly you could install apache yourself, however it is not that easy.Hope this helps.
  15. Have you considered using javascript / ajax and some sort of scrolling script, or even frames?
  16. hmmm, sounds complicated.May look into finding the pixels that lie along the lines of the edge of the polygon and finding if the path crosses one of these lines.Thanks for the posts.
  17. that would take a very long time as the polygon is very large.ahh well i will have to think of some alternative method.Thanks very much anyway
  18. You mean every pixel, there is no way to find out what pixels are within a polygon area??
  19. I think: ///////////////////After successfully "logging in" (finding a username/password match), this script is executed to set the cookies. /* Login Success */ /* Set Expiration Date */ $expdate = time()+(60*60*24*30); /* 30 days*/ /* Find ID */ $queryinput = 'SELECT id FROM users WHERE username =\'' . $username . '\''; $results = mysql_query($queryinput); $array = mysql_fetch_array($results); $id = $array['id']; /* Set Cookie */ setCookie("id", $id, $expdate); setCookie("username", $username, $expdate); echo '<script type="text/javascript">'; echo 'alert("' . $_COOKIE["username"] . $id . '");';////////////////Temporary Debugging element echo '</script>'; Hope this helps.
  20. Forgive me if i'm wrong but i think a simple mysql select query would suffice:say the page is "yourpage.com?id=10" <?php// Connects to your Databasemysql_connect("fdb1.awardspace.com", "chidorisoul_sh", "******") or die(mysql_error());mysql_select_db("chidorisoul_sh") or die(mysql_error());$selectUser = mysql_query("SELECT * FROM users WHERE id = '" . $_GET['id'] . "' ");$user = mysql_fetch_array($selectUser);$username = $user['username'];//etc?> Hope this helps
  21. Im dont think there is a way of stopping the browser from asking if the user wants to resend the information however a way to avoid this would to have the submit button goto a seperate page, do whatever you want it to do and then redirect to the first page again. I'm not sure if this is what you are asking as the post is a little complicated (or i'm just being stupid). Hope this helps.
  22. duncan_cowan


    I may be wrong but i believe that $_GET is always set and values are defined to it.try: if (count($_GET)!=0) {header('Location index.php?m=1')} Hope this helps.
  23. I have a map of the world and each country is an area on an image map.The user will select a start location and an end location and the script will cycle through each pixel in a direct line from the start to the end and i want to find out what country the pixel is in or if it is over sea.
  24. Thanks for the reply but Im afraid that doesnt help ...
  25. Hi,I was wondering if there is a way to find what area, of an image map, a given pixel is in?ThanksDuncan
  • Create New...