1,330 Posted Topics

Member Avatar for Eagle.Avik

That is what jquery's `.one()` is for. $("#modal-launcher-user").one('click', function() { ... });

Member Avatar for Eagle.Avik
0
691
Member Avatar for wolexade

Two points: * It is somewhat academic but javascript arrays are strictly unidimensional. There's no such thing as a multidimensional array in javascript, however you can create an array of arrays, which is almost the same thing. It appears that this is what you are trying to do here. * …

Member Avatar for Airshow
0
476
Member Avatar for Daniel_18

It should seldom (never?) be necessary to serve "executable code" as text as you have indicated. There are much better ways to serve javascript onto a page. Your first design choice should be to hard code your client-side script(s) and serve them in the web page between '<script></script>' tags or …

Member Avatar for Airshow
0
299
Member Avatar for bops

First, simplify the main function by pulling out the two ajax calls into their own functions as follows: function fetch_1(_postcode) { return $.ajax({ url: 'http://maps.googleapis.com/maps/api/geocode/json', data: { address: encodeURIComponent(_postcode) + ',UK', sensor: 'false' } }); } function fetch_2(location) { location = location || {lat:0, lng:0};//null geo-location, to be handled server-side …

Member Avatar for Airshow
0
275
Member Avatar for suavedesign

IIRC, z-index only affects the layering of z-indexable elements (position:absolute, position:relative, or position:fixed). Layering of such elements with respect to those in the normal flow (position:static) can only be achieved by the ordering of nodes within the DOM. Try moving your cover and popup divs to the very end of …

Member Avatar for suavedesign
0
7K
Member Avatar for Julia25

Hi Julia. Why would the current script not work for two categories? As long as the ids of the divs' are unique and follow the same naming rules ("message-n" and "respond-n"), then everything should work. Unless I'm missing something, categorisation should just be a question of layout - eg category …

Member Avatar for Airshow
0
567
Member Avatar for george61

, Github.com seems to require registration. I expect you want something like this: [CODE] var img = [ "images/1.jpg", "images/2.jpg", "images/3.jpg", "images/4.jpg", "images/5.jpg", "images/6.jpg", "images/7.jpg", "images/8.jpg", "images/9.jpg", "images/10.jpg", "images/11.jpg", "images/12.jpg" ]; img.current = 0; function showImage(i) { $('#imag').fadeOut( function() { this.src = img[img.current]; $(this).fadeIn(); }); } function NextImage() { img.current …

Member Avatar for Mukund_1
0
1K
Member Avatar for ronaldpaul

[QUOTE=ronaldpaul;1146725]I want to use different javascript functions with different onblur events. For eg:- [CODE]<input type="text" onblur="test()"><br/> <input type="text" onblur="testrun()">[/CODE] where test() and testrun() are diff. javascript functions.[/QUOTE] I can see nothing to prevent that from working. If you need the functions to be aware of which text box called them, …

Member Avatar for gökhan_1
0
7K
Member Avatar for tqmd1

tqmd1, Two points: 1. You have jQuery available, so you might as well use it 2. You may want to return `true` on success. This probably doesn't matter but it's good practice given that you return false on failure. Like this: function checkEmail() { var $email = $("#xemail"); var filter …

Member Avatar for Airshow
0
170
Member Avatar for mbarandao

Hi Mossa, If you build the link as follows ... echo "<a class=\"playerState\" href=\"\" data-pid=\"$membId_stripped_array_clean_phase2\" data-plname=\"$lname\" data-pfname=\"$fname\" title=\"$membId_stripped_array_clean_phase2\"><span style='font-size:1.5em'>$playerState_array_clean_phase2</span></a>"; ... and build the HTML as follows (or similar) ... <div class="iBlock"> <p>PID: <span class="pid"></span></p> <p>First name: <span class="pfname"></span></p> <p>Last name: <span class="plname"></span></p> <!--Other code stuff goes here--> </div> ... then …

Member Avatar for iamthwee
0
3K
Member Avatar for patk570

Patk, there's not enough information in the question to be able to answer it. In order to help you, we would need to see at least the HTML on which the filters act. Once that is known, there would be two possible approaches : 1. AJAX: Fetch data from which …

Member Avatar for Airshow
0
489
Member Avatar for david.roun.7_1

David, when you call a function you pass *parameters*. In the function, references to the parameters are called *arguments* or sometimes *formal variables*. Get your mind round arguments and parameters and everything will become clear.

Member Avatar for Airshow
0
151
Member Avatar for Lonestar Jack

It shouldn't be necessary to make two AJAX posts for what is effectively one action. You should be able to do a single `$.post()` thus simplifying both the client-side and server-side code, and avoiding the need to store the key/value pair in the Session, which (unless needed for another reason) …

Member Avatar for Airshow
0
167
Member Avatar for ogok2010

I'm pretty sure there are previous "help me with hangman" questions here on Daniweb. Try searching. I'm not suggesting you copy someone else' code but gleaning ideas is acceptable - even for homework IMHO!

Member Avatar for Airshow
0
149
Member Avatar for mbarandao

Hi Mossa, I've given the code a good once over all through. There's a lot of uncertainty in it so I may have broken more than I've fixed, however the overall structure should now be correct. You will need to rework various lines to ensure it does exactly what you …

Member Avatar for mbarandao
0
753
Member Avatar for Mona Ali

Airshow's security rule no 1 : only ever send passwords from client-to-server, never from server-to-client. [B]Airshow[/B]

Member Avatar for raviragarwal292
0
2K
Member Avatar for rook0316

Rook, Client-side (javascript & HTML) aspects are pretty trivial especially if you use jQuery, which I recommend for an application like this. jQuery will make the code much more concise and (ultimately) more readable. Making a request to the server will be a simple matter of sending (via ajax) the …

Member Avatar for pankaj12290
0
8K
Member Avatar for daniel.pareja.315

If `moreFields()` is modified to work with arguments, then you can't simply attach the function as the onload handler. You have to create an event handler from which the function is called in the right way. For example : window.onload = function(event) { moreFields('water_src', 'water_drop'); }

Member Avatar for daniel.pareja.315
0
155
Member Avatar for Violet_82

Violet, The trick is to avoid the need for one function per thumbnail by writing a generalised function, which I have attempted below: [CODE=html] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ var $main_pic = $("#pic_1"); var $current_thumbnail = null; var …

Member Avatar for 1@3RaJa
0
2K
Member Avatar for Valten1992

There are two issues here : Unreliable interval --- This is most probably caused by internet/server lag. For short intervals it's better to call `setTimout()` from a `.load()` callback function thus imposing a delay starting from when each server response has been handled. Loading each div individually --- You could …

Member Avatar for darshit9u
0
707
Member Avatar for Martin C++

I guess it's a question of getting the regexp correct, then knowing what to do with it. Something like this maybe : $("#nickname").keyup(function(event) { var validate = /^(_|[A-Za-z0-9])*$/; var nickname = $(this).val(); var ok = validate.test(nickname); $("#message-area").html(ok ? 'ok' : 'not OK'); });

Member Avatar for Martin C++
0
188
Member Avatar for glennt

Glennt, you appear to describe something known as "session crosstalk". It's not a subject I know much about but Google gives several results for "ASP.net session crosstalk", indicating that it's not an unknown issue.

Member Avatar for Airshow
0
341
Member Avatar for Yarra

> if I just invoker "render();" the function does not run Does not run, or does not have any effect? Two completely different animals.

Member Avatar for Airshow
0
133
Member Avatar for iamspix
Member Avatar for mr0277

Try establishing the onload handler before setting the src. In other words have the two statements in the following order : tmpImg.onload = onImageLoad; tmpImg.src = jQuery(this).attr('src'); With cached images, this can matter. **Edit** Also, attach the handler with `tmpImg.onload = onImageLoad` not `tmpImg.onload = onImageLoad()`

Member Avatar for Troy III
-1
298
Member Avatar for techyworld

OP, you are in "JavaScript / DHTML / AJAX" and javascript doesn't have associative arrays.

Member Avatar for Airshow
0
163
Member Avatar for Torres_1991

Questions: - Why record the selections - must they be avialable in subsequent sessions and/or to other users? - Is there any penalty in including the urls of all 30 images in the downloaded page?

Member Avatar for Airshow
0
109
Member Avatar for Szabi Zsoldos

The problem lies in having multiple `id="del"`. Ids must be unique, so use `class="del"` instead, and adjust the jQuery selector accordingly.

Member Avatar for Szabi Zsoldos
0
249
Member Avatar for PsychicTide

You will find the code is much easier to write against a rephrased goal. > Goal: > I have 4 radio buttons, which determine the style applied to a DOM element. > 1st: style 1 > 2nd: style 2 > 3rd: style 3 > 4th: style 4 > By giving …

Member Avatar for PsychicTide
0
234
Member Avatar for wonderland
Member Avatar for Dani

Hi Dani, The jQuery documentation for `dataType:'script'` includes the statement : > Note: This [setting the cache option to true] will turn POSTs into GETs for remote-domain requests. Although the section for `dataType:'jsonp'` doesn't include the same note, I rather imagine that the same applies - after all `jsonp` is …

Member Avatar for Dani
0
437
Member Avatar for RazorRamon

Razor, it's not clear why you might want to define `.droppable()` in a loop and maintain an array of counters. Each `.droppable()` statement will override the previous one so only the last `.droppable()` will be in effect when the loop terminates. The simple answer to your question is that `alert(play[i]);` …

Member Avatar for Airshow
0
680
Member Avatar for petrakid

Rocky, [CODE] <script src="http://code.jquery.com/jquery-1.6.3.min.js"></script> <script src="js/jquery.filedrop.js"></script> <script> var confyear = <%php echo $confyear; %>; </script> <script src="js/script.js"></script> //THIS JS now KNOWs THE $confyear!! It is the javascript global variable confyear. [/CODE] With a little thought, you can avoid using the global namespace if that is important to you. One way …

Member Avatar for unikorndesigns
0
919
Member Avatar for jonsan32

Hi Jonsan, I think the problem here is repeated ids, and can be fixed by using classes instead. Try changing all the LI elements from : <li class="merk" id="m_CLINICS"> to : <li class="merk m_CLINICS"> The corresponding javascript will be as follows : $(function() { $('.brand').on('change', function() { var $checked = …

Member Avatar for Airshow
0
722
Member Avatar for jonsan32

Hi Jonsan, Good to see you again. I have had a good hack at everything. You know me :twisted: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> td#controls { background-color: #000; color: #FFF; width: 200px; } td#controls ul { margin: 0; padding: 0; list-style-type: …

Member Avatar for jonsan32
0
3K
Member Avatar for vizz

Hi Vizz, It happens sometimes. We've all done it. Best way out of accidental posts is to click "Flag Bad Post" and ask a moderator to delete it for you. I have some moderation authority but not deletion. The guys at Daniweb Central can do all sorts. They are all-powerful. …

Member Avatar for vizz
0
189
Member Avatar for albertkao

Try 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>Untitled</title> <script> function docwrite(x) { document.write(x); } </script> </head> <body> test<br /> <script type="text/javascript"> docwrite(1); document.write(' hi'); docwrite(' hello'); docwrite('<br />'); </script> docwrite(2); </body> </html> [/CODE] Note how [ICODE]docwrite[/ICODE] is defined in the [ICODE]<head>[/ICODE] and it is …

Member Avatar for priakant
0
3K
Member Avatar for solomon_13000

Path navigation: - `/` : site root - `./` : same directory (optional) - `../` : parent directory - `../../` : grandparent directory - `X/` or `./X/` : down into directory X Everything except `/` works relative to the current page. Therefore, try : url: 'foo.htm', or url: './foo.htm',

Member Avatar for Airshow
0
1K
Member Avatar for Farhad.idrees
Member Avatar for Tko_1
Member Avatar for lunie15

[QUOTE=mahavir123;1389428]Create a div to next to the text box or any field where you want to display something like. [code]<div id ="err1" style = "display:none">error message</div>[/code] In validation function [code] function val() { if(error_condition) { document.getElementById('err1').style.display = "block"; } } [/code][/QUOTE] Thet's fine as far as it goes but you …

Member Avatar for Bachu
0
1K
Member Avatar for hlamster

Hal, Try this: function showHideRows(clsName, hideshow) { var table = document.getElementById('fullTable'); var rows = table.getElementsByTagName('tr'); for(var i=0;i<rows.length;i++) { if(rows[i].className != clsName) continue; if(hideshow == 'hide')//note: double == { rows[i].style.display = 'none'; } else { rows[i].style.display = 'table-row';//note: table-row } } } **[DEMO](http://jsfiddle.net/nRy6D/1/)** or this shorter version, which is essentially the …

Member Avatar for hlamster
0
614
Member Avatar for DrChocolate

A couple of points to help you get an answer : - The question is 100% client-side. People need to to see the served HTML, not the PHP souce that generates it. - I can't see that Java is relevant and expect you mean "Javascript".

Member Avatar for Airshow
0
351
Member Avatar for mbarandao

Mbar, Try: [CODE=javascript] xmlhttp.open("GET", window.location.pathName+strss, true); [/CODE] [B]Airshow[/B]

Member Avatar for DrChocolate
0
4K
Member Avatar for jonsan32
Member Avatar for Airshow

Tablesorter (currently v2.0.5) includes an "update" method. This method keeps a Tablesorter object up to date with dynamic changes made to its table(s). Like other Tablesorter methods "update" is implemented in the form of a custom event. A typical method call would be $table.trigger("update"); , where $table is a jQuery …

Member Avatar for punknroll
0
822
Member Avatar for samith.dilhara

The [jQuery documentation](http://api.jquery.com/html/) includes the following note for its `.html()` method : > This method uses the browser's innerHTML property. Some browsers may not return HTML that exactly replicates the HTML source in an original document. For example, Internet Explorer sometimes leaves off the quotes around attribute values if they …

Member Avatar for Airshow
0
192
Member Avatar for fcvolunteer

fcVol, I think it best to switch from event-driven logic to event-stimulated state-driven logic. In other words, logic by which the state of *all* relevant elements is addressed when *any* of the three buttons is clicked. This caters more simply for the mutually exclusivity of dad/mom, and associated changes of …

Member Avatar for ome2012
0
1K
Member Avatar for Mike_H

Hi Mike, Try this: http://jsfiddle.net/MvYmR/1/ It needs a bit more work to keep the image centred as it zooms.

Member Avatar for Airshow
0
975
Member Avatar for zacharysr

Compare strings - true/false - easy. Error count - unknown paradigm - difficult.

Member Avatar for Troy III
0
286

The End.