Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by paulclift

  1. I have an autocomplete() function connected to a MYSQL database. The jquery is completely run of the mill: $(function() { $(".choose_venue").autocomplete({ source: "list_venues.php", minLength: 1 }); }); ...and if I manually add a query such as "list_venues.php?term=Ku" onto the URL of list_venues.php, then that page gives a appropriate response (such as the following): [{"name":"Fonderie Kugler"},{"name":"Kulturhaus Helferei"},{"name":"Kunstraum Walcheturm"}]So, a simple `input` such as the following *sh
  2. @justsomeguy Thanks for your response. I am not particularly knowledgable with JS .... could you describe your solution in a little more detail please?
  3. I am displaying data from one page in another page in the following way: <script> $(document).ready(function(){ $( "#2017" ).load( "data.html .2017" ); $( "#2016" ).load( "data.html .2016" ); }); </script> <div id="2017"></div> <div id="2016"></div> ...BUT I also need to be able to hide (onload) certain div classes from within the linked file... <script> $(document).ready(function(){ $('.private-files').hide(); }); </script> I know that the code above will hide divs by class
  4. Thanks justsomeguy, but this seems to be something which is in development and does not quite suit my needs in this specific case..
  5. Hey all, I have a language switch on a website which updates the displayed language in the main iframe. However, I am also using fancy box, which pops up out of the iframe, and is therefore an iframe within an iframe. I change the language to be displayed with the following code: function setlang(lang) { var i; var len; var list; var ifr = document.getElementById('mainframe'); var cw = (ifr.contentWindow || ifr.contentDocument); list = cw.document.getElementsByClassName('langdiv'); for (i=0, len=list.length ; i<len ; i++){ list.style.display = 'none'; } list = cw.document.ge
  6. I was wondering if someone could come up with a way of using the current date to set the position of a div. I would like to apply such a process to this page: http://www.paulclift.net/news.html The object in question which I would like to move automatically up and down, so that it is in the appropriate place relative to the other items on the page, is the three HR lines with past/future written above & below it. There must be a way to do this - not having to constantly move this object, and others like it on other pages, would be a huge time-saver! Please help if you have any i
  7. Just realised I never thanked you for this, justsomeguy - so thanks very much - your code really helped me out a lot!
  8. AHHHH yes, the '.' before 'contentWindow' ..... now we're in business
  9. I think perhaps that it would be better just to switch to an 'if' and 'else' .... your thoughts?
  10. With this code: <script> function setlanguage(language, n1, n2, n3) { var ShowLang = document.getElementById('mainframe').contentWindow.document.getElementsByClassName(language); for(var i = 0; i < ShowLang.length; i++) { ShowLang.style.display='none'; } var HideLang = document.getElementById('mainframe')contentWindow.document.getElementsByClassName(n1); for(var i = 0; i < HideLang.length; i++) { HideLang.style.display='none'; } } </script> ...I get the error message "SyntaxError: Expected an identifier but found 'contentWindow' instead" for
  11. hmmm it seems that having two 'for's or two 'var's in my function is causing the problem...... I thought that that was okay?
  12. Thanks for the help...... that's good for a start, but I noticed that if I replace 'n1' with, for example 'IT', those divs still don't disappear from the page loaded inside the iframe..... I cannot understand why that part is not working!
  13. I noticed that other people seemed to have gotten the above javascript running with a 'getElementById' rather than by ClassName....... but surely that would not stop it from working.... Also, I know that an 'if' and 'else' inside the function would be rather more elegant....
  14. So the following seems promising, but is not working for me for the moment: <script> function setlanguage(language, n1, n2, n3) { var ShowLang = document.getElementById('iframe').contentWindow.document.getElementsByClassName(language); for(var i = 0; i < ShowLang.length; i++) { ShowLang.style.display="block"; } var HideLang = document.getElementById('iframe')contentWindow.document.getElementsByClassName(n1, n2, n3); for(var i = 0; i < HideLang.length; i++) { HideLang.style.display="none"; } } </script> <body>
  15. Hmmm is that right? I was looking for other instances of this and got the impression that it was possible..... my other thought was to use sessionStorage and pass the value to the iframe documents, but if you could simply control the iframe pages from the index.html it would be much cleaner....
  16. I am trying to use a simple radio button in my main page to show and hide divs by class which are inside an iframe. Here are the relevant snippets of code: In the "index.html" : <head> <script> function setlanguage(language) { ..........will save myself the embarrassment of showing you my attempts at coding this................. } </script> </head> <body> <input id="english" type="radio" checked onclick="setlanguage('EN')"> <input id="deutsch" type="radio" onclick="setlanguage('DE')"> <input id="francais" type="radio" onclick="setlangu
  17. Hey Davej, Sorry, I don't quite get what you mean... wouldn't this lead to the same problems if I can't specify a 'group' of classes? I have been trying for ages to get the 'for' to apply only to divs when a given class is declared, but it is beyond me...
  18. ...or perhaps there is a better way, with two 'if's, so that only <divs> of group1 are tested for 'other-variable' ??
  19. Hey guys, So, since I have other divs on the page that I don't want to be affected by this, how can I apply it to multiple classes? <div class="group1 myclassname"> <div id="some-other-thing-which-should-remain-visible"> The 'display' variable should only affect divs with 'group1' ..... should be something like the following, I assume? if(spans.className == "group1" + other-variable)
  20. Woah, I suddenly feel very out of my depth! I assumed that there was an easy fix for this. If it makes anything simpler, no element has more than one class name, since I am using this purely to hide and show <P> objects (not divs like in my first post)... could you please tell me how to use the code you posted? I tried stupidly cutting and pasting it, keeping the for loop which I already had, but nothing..
  21. Thanks for your help.... I tried the following, but it doesn't seem to be working. var divs = document.getElementsByTagName('div'); if(divs.className == 'myclassname' ) { divs.style.display= 'block'; } else { divs.style.display= 'none'; } Any ideas what I am missing here?
  22. Yes, I think that you're right, but would you know how I can tell it to do this: document.getElementsByClassName(NOT "myclassname") style.display='none'
  23. Hey all, Could someone please tell me what I can add to this code to make it so that divs whose class does NOT equal "myclassname" will NOT display? var divs = document.getElementsByClassName("myclassname"); for(var i=0; i<divs.length; i++) { divs.style.display='block'; } Thanks.
  24. Solved! I just had to replace: var current_url = document.getElementById("mainframe").src; with var current_url = document.getElementById("mainframe").contentWindow.location.href;
  25. Thanks for the response. I was just working on this now.. it works partly but the 'mainframe.src' which is reported to javascript function never changes, even when a different page is loaded..... I don't quite get why; is it because I specify the src in the 'inline' object itself? <!--SWITCH STUFF--!> <div class="switch> <input id="english" name="view" type="radio" checked onclick="change_language('EN')"/> <input id="deutsch" name="view" type="radio" onclick="change_language('DE')"/> </div> <!--IFRAME STUFF--!> <div id="iframe"> <
  • Create New...