1,330 Posted Topics
Re: In jQuery, you can address the two divs collectively as follows: [CODE] $("div.myclassname").hide(); [/CODE] Or individually as follows: [CODE] $("div.myclassname").eq(0).hide(); //first div $("div.myclassname").eq(1).hide(); //second div //etc. [/CODE] In these examples, the div(s) are hidden. For some other action, change [iCODE]hide()[/iCODE]. [B]Airshow[/B] | |
Re: Joe, I expect you are seeing a comma between each entry of the array. Try outputting [iCODE]css_code.join('')[/iCODE] to join the elements without commas. You can also simplify the code slightly as follows: [CODE]var css_code = [];//shorthand for new Array() css_code.push("<div style='height: "+square_height+"; width: "+square_width+"; "+square_rounded+" border: "+border_width+" "+border_type+" "+border_color+"; position: … | |
Re: Aeterna, The javascript [iCODE]Date[/iCODE] object is essentially a variable representing a number of milliseconds since midnight 1 January 1970, plus a raft of methods for setting and getting this value in a variety of formats. Date subtraction is very simple. [CODE=javascript]var difference = date2 - date1;//where date2 and date1 are … | |
Re: jQuery's noConflict method allows jQuery to coexist with other libs (eg. Prototype), which use $ as ana alias. As these libs all install themselves in the global namespace, there's no point calling [iCODE]jQuery.noConflict();[/iCODE] anywhere other than in the global namespace (ie not inside a function). [B]Airshow[/B] | |
Re: Sunny, It's hard to see what this loop is supposed to do: [CODE] while(current_plan_id < ('.sample_plan').length){ [/CODE] It may be at least part of your problem. [B]Airshow[/B] | |
Re: WolfShield, The main thing is that the javascript runs as the page loads before the browser has had a chance to convert the HTML into DOM elements and then rendered them. You need to cast the code inside an "onload handler", which runs [U]after[/U] the page has loaded. Another thing … | |
Re: Aksel, If I understand correctly, you put a (jquery?) plugin in place on the page then try to attach that plugin's functionality (colorbox) to links that are dynamically inserted, with ajax, into the DOM. The first question is whether colorbox functionality can be successfully attached to links with class="modal" (etc) … | |
Re: Metalix, That's all you have to do sometimes. Post your problem on Daniweb and it sorts itself :icon_idea: [B]Airshow[/B] | |
Re: Violet, The reason the transitions are not smooth is due to the size of the images. At 300k to 400k the fadeout/fadein effects give browser and graphics card a lot of work to do. Zero 13 is probably driving something ritzy, at least ritzier than this 9 year old machine. … | |
Re: Soben, There's essentially two ways to do this, depending on whether or not you need the form to be submitted. [LIST=1] [*]To submit the form to a dynamically determined url: In the onsubmit handler, include a line of the format [ICODE]form.action = url;[/ICODE], and return true to allow form submission. … | |
Re: Jeff, nice article. I just have to ask two questions. Would the sentence "The original array contains the divs in the document" better read "The original jQuery object contains the divs in the document", or to be really picky, "The original jQuery object contains [U]references to[/U] the divs in the … | |
Re: Four widths are specified in the CSS. Try subtracting 20px from each of these widths. If 20px is not enough, try subtracting another 10px and so on ... Before you start, make a note of the original values in case it all goes wrong. [B]Airshow[/B] | |
Re: Inny, The whole page really needs to be tidied up. [list][*]Indenting/line feeds [*]Head should contain only metas, script(s) and stylesheet(s), no content/markup [*]Scripts should only be placed inline when they use document.write to create markup.[/list] I can't find checkOnClick on the page. If you want no onclick action then disassociate … | |
Re: I can't see that you would want the Google control to be part of your own form, which will submit to a different (non-Google) server. In fact, as far as I can tell, you positively shouldn't try to merge the two. However, you can adapt the code you were given … | |
Re: CutexxBaby, I think you just need to move the code around a bit, to do all the esri. stuff inside the for loop instead of concatenating the coordinate strings: [CODE] ... var books = eval(mygetrequest.responseText); //retrieve result as an JavaScript object var rssentries = books.places; var stX, stY, pt, attr, … | |
Re: Fibinacci, Everything urtrivedi said, plus you might consider using some ready-developed software rather than writing your own from scratch, which would be time consuming and prone to security issues. I have not used it myself, but I think [URL="http://wordpress.org/"]Wordpress[/URL] must be a prime candidate for your application. In my opinion, … | |
Re: Inny, I think you want a toggle action to show/hide the geckos div and simultaneously to switch the button's value. [CODE=javascript] function toggle_geckos(button) { var buttonText = ['Lock Up Geckos', 'Release Geckos']; var el = document.getElementById("geckos"); el.style.display = (button.value==buttonText[0]) ? 'none' : 'inline'; button.value = (button.value==buttonText[0]) ? buttonText[1] : buttonText[0]; … | |
Re: Surely, these limits are not the issue. It's the involvement of a 3rd party in the provision of a "security layer". That said, this is something I was unaware of, so I am grateful for the post. [B]Airshow[/B] | |
Re: Mmmm, I don't really know much about this topic area but found a discussion here: [url]http://www.infoq.com/news/2007/07/pushvspull[/url] [B]Airshow[/B] | |
Re: Must say, Alloy looks good but the documentation is severely lacking. I can't find any tutorials either. [B]Airshow[/B] | |
Re: ari$av3s, I think it's easy (but I have said that before). (untested) In the demo script, try adding right at the bottom of the [iCODE]$(function() {...});[/iCODE] a line, which stimulates a click on the first menu item: [CODE] /* call the init method of Menu */ Menu.init(); $("#mb_menu a").eq(0).click();//this is … | |
Re: Divyakrishnan, This will allow you to add text fields progressively. [CODE] function add() { var mydiv = document.getElementById("my_div"); var div = document.createElement("div"); mydiv.appendChild(div); div.className ="dynamicDiv"; div.innerHTML = "<input type='text' name='mytext[]' value='mytext' />"; } [/CODE] [B]Airshow[/B] | |
Re: I think your best bet is to try a jQuery plugin. [URL="http://timeglider.com/jquery/"]Timeglider[/URL] - not quote as you describe but may do the job. [URL="http://plugins.jquery.com/plugin-tags/timeline"]Here[/URL] are some more. If none of these is suitable, then you could try customising a [URL="http://jqueryui.com/demos/slider/"]jquery UI slider[/URL]. You could also look at other frameworks. [URL="http://www.prototypejs.org/"]Prototype[/URL] … | |
Re: cdes, That depends entirely on what you mean by "align". [B]Airshow[/B | |
Re: Anandhikrishnan, += is very inefficient when used to aggregate a string from many component strings. Never ever do it this way. Instead, aggregate the component strings in an array then use [ICODE]array.join(glue)[/ICODE] to put the pieces together. By default the "glue" is ',' (comma). [CODE] function(result_arr) { var reason_ids = … | |
Re: BlackKite, Try: [CODE] echo (" <form action='#' method='POST' name='update_song' onSubmit='return updateSong(\"$song\")'> [/CODE] Note, I have changed the form tag's name and added [iCODE]return[/iCODE] to the onsubmit statement. [B]Airshow[/B] | |
Re: Realnsleo, The bulamu.net example is really just one page, but organised into a set of "tiles" to give the appearance of separate pages. The transitional slide effect is achieved with mootools. I am not a mootools expert. You can find out more by viewing the source then penetrating the various … | |
Re: Your simplemodal/thickbox approach should work but you should be able to achieve it with just one modal div (plus its contents) in total. This should work providing you want just one video to play at a time. Accommodate the various videos with DHTML/DOM scripting (javascript). I can't help with the … | |
Re: Nathan, View the page's source and search for "fillsdfkalsjdfak". You will find the function that writes the dots on the page. You will also need a small stylesheet, slightly higher up in the source. Search for "img.zerosafdfasd". You might like to grab your own copy of the dot image and … | |
Re: [URL="http://en.wikipedia.org/wiki/JSONP"]JSONP[/URL] JSONP is supported by jQuery. Neither you nor your users should have security concerns if all servers involved are members of a "mutually trusted group". [B]Airshow[/B] | |
Re: Oggiemc, Scopes here are maybe not obvious. The outer function forms a "closure" giving each instance of the inner function access to [ICODE]numAray[/ICODE], [ICODE]resultArray[/ICODE] and [ICODE]result[/ICODE]. In javascript, objects (including arrays) are equated and passed by reference (not by value). Consequently: [LIST] [*]the formal parameters [ICODE]numArray[/ICODE] and [ICODE]resultArray[/ICODE] are actually … | |
Re: There's nothing to prevent raw javascript and jquery co-existing. You just need to invoke appropriate code in response to relevant user events. The code will typically be organised in functions, each of which can contain raw js or jquery or a mixture of the two. You probably just need to … | |
Re: Whilliam, It may be as simple as putting the value in single or double quotes: [CODE] <input type="hidden" id='sessio' value="<?php echo $_SESSION['iden']; ?>"> <script type="text/javascript"> var x = document.getElementById('sessio').value; window.location="index.php?link=2&var=" + x; </script> [/CODE] Alternatively, you can write $_SESSION['iden'] directly into javascript without needing to retrieve it from the DOM. … | |
Re: Benjamin, Why is the dialog fetched by ajax and not hard-coded on the page? [B]Airshow[/B] | |
Re: Hi Gambit, I've never seen [ICODE]$(document).ready(...)[/ICODE] inside a function before. Can you explain the reasoning behind that please? To answer your question, there are two ways to access your data: [LIST=1][*]Declare the member, [ICODE]var match_groups = [][/ICODE], in an outer namespace, (eg. as a global, though this should be avoided), … | |
Re: tK, I'm in guesswork territory here......... I think I'm right in saying that [iCODE]$('img.faded').live('click', ...[/iCODE] and [iCODE]$('img.highlighted').live('click', ...[/iCODE] will only keep up with matching elements at the time they are inserted, not when their highlighted/faded classnames are changed. If so then the workaround would be to put in place a … | |
Re: Klemme, That's just about correct. Here's the HTML/javascript in full (sans php): [CODE] <a href="process_delete_page.php?pid=999" onclick="return confirm('Are you sure you want to delete the page?')">Delete page!</a> [/CODE] [B]Airshow[/B] | |
Re: You could try [url]www.geonames.org[/url] but I think it gives just a centrepoint for each post code area, not the whole locus. [B]Airshow[/B] | |
Re: xiiopao, It's more likely something to do with your Tomcat configuration than the javascript. Maybe the server is not set up to respond to the .html extension. [B]Airshow[/B] | |
Re: BenJaYin, Try returning/replacing the entire <select>...</select> menu, not just the options. [B]Airshow[/B] | |
Re: Kokfui, The question appears to be about an HTML table but the answer is about a database table - very different animals. Which is it? [B]Airshow[/B] | |
Re: Joe, Used that way, document.write will blitz the entire document. Thereafter Build_Blog no longer exists. document.write is generally only used in inline scripts embedded in the HTML, or to write the contents of a child window or iframe. [B]Airshow[/B] | |
Re: Turpentyne, By constructing the leaf images as "masks", it should be possible to do something like this: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Demo by Airshow</title> <style type="text/css"> #leafImage { width: 70px; height: 70px; border: 2px solid #666; } #controls { margin: 5px 0px; padding: … | |
![]() | Re: If it's a question of security, then there's no way to absolutely guarantee that a determined user will not somehow discover the testID/userID parameters. Any data that goes client-side is vulnerable. If it's just a question of hiding something rather ugly, then you can suppress the opened window's address bar … |
Re: Filch, There's no point using javascript unless it is necessary to dynamically show/hide fields on the page after it has been served, in response to user events. Anything that the user will never see (except be re-serving the page) can be excluded at the php level. As far as I … | |
| |
| |
Re: Msqueen, Javscript written in an HTML onclick/onchange/onblur etc. is nothing more than the contents of an anonymous function. Therefore, simply separate statements with semicolons. [CODE] <... onclick="guess(); setFocus();" ...> [/CODE] [B]Airshow[/B] | |
Re: ASG, Form submission makes a regular (non-ajax) HTTP request so if you want ajax, ensure that the form is not submitted. If the submit button performs ajax, then the code for onKeyUp should be similar. [B]Airshow[/B] | |
Re: There's no need to remove anything. Instead just .hide(), then the elements are right there in the same place in the DOM and can be shown again with .show(). [CODE] $("input[name='online_only_bus']").click(function(){ if($(this).is(':checked')){ $('.detach_field').hide(); } else{ $('.detach_field').show(); } }); [/CODE] [B]Airshow[/B] |
The End.