1,330 Posted Topics

Member Avatar for felgall

As far as I can tell, this is just a heavily disguised `setTimeout()`. Two points : - Anyone who's been writing javascript for a while should be able to write a `setTimeout()` for themselves. - There's a danger in disguising the `setTimeout()`that people will think this is a classical `sleep` …

Member Avatar for Troy III
0
367
Member Avatar for Naimathullah

Naimathullah, The easiest approach by far would be to set an `alt` attribute in the img tags. However, if you want a custom mouseover effect, try the following. Build the HTML like this: print "<p><img class=\"realtor\" src=\"images/$image_file\" data-name=\"$fullName\" /><br />$firstname</p>\n"; And the corresponding javascript is : window.onload = function() { …

Member Avatar for Airshow
0
706
Member Avatar for ajay.motah

Displaying the right message requires a fairly trivial reorganisation of the code. Another, more significant problem is that sequential ajax responses are not guaranteed to arrive back in the same order as the requests were sent. This is particularly likely when requests are issued rapidly (eg. in response to key …

Member Avatar for Airshow
0
127
Member Avatar for Dani

Hi Dani, Yes I've always disliked document.write() in ad scripts and elsewhere. I think you must be onto the right approach with `$('#foo').html(string)` and `$('#foo').append(string)`. I wasn't aware that script tags wouldn't work when written in this way but I expect it's the browser engine that won't play ball rather …

Member Avatar for Troy3
0
2K
Member Avatar for xjshiya

xjshiya, You can considerably shorten the code and avoid having to maintain a dedicated sequence-tracking array by further exploiting jQuery and reading the DOM on the fly every time the button is clicked. $(function(){ var seq = 0, $ch = $('input[type="checkbox"]').on('click', function() { $(this).data('seq', seq++); }); $("input[type=button]").click(function() { var str …

Member Avatar for urtrivedi
0
4K
Member Avatar for jckb188

jckb188, Need a bit more to go on: - "get a PHP variable" : How served; as part of the original page or in response to an AJAX call? - "to go into a form": What part of the form; as an attribute of the form tag, as a value …

Member Avatar for Airshow
0
326
Member Avatar for grant.baker

You can keep the regexp simple, as follows : if(((entry_54.match(/[A-Z]{3}[0-9]{3}/g) || ['']).join(', ')) !== entry_54) { //do something } This works on the basis that if the matching parts joined back together with the separator yield the original string, then there's a match, otherwise no match. `['']` is included to …

Member Avatar for grant.baker
0
291
Member Avatar for maranda.blanks
Member Avatar for Annuscha

HTML tags are out of balance. 4 divs opened, only 3 closed. Also, the javascript expects one slidedeckNav per slidedeck_frame but in the HTML there is only one slidedeckNav in total. You need to sort out the HTML before anyone can help with the javascript.

Member Avatar for Airshow
0
118
Member Avatar for rotten69
Member Avatar for Troy III
0
227
Member Avatar for <M/>

> Can someone help me out with this question? What question? There isn't one. > Please Respond a.s.a.p! "Please" is cool but use of the [imperative](http://en.wikipedia.org/wiki/Imperative_mood) is not. Also, "a.s.a.p!" is a great way to be ignored.

Member Avatar for <M/>
0
172
Member Avatar for James456
Member Avatar for Airshow
0
139
Member Avatar for blumonde

It's not clear, is this a script that composes the page with the form on it or a script that's executed in response to the form being submitted? Much of the code indicates the one and the rest indicates the other.

Member Avatar for lambing
0
196
Member Avatar for smoothe19

Sir Saula, `{"cool":"34.33","alsocool":"45454"}` is a plain javascript object not an array. Add extra properties as per Lambing's suggestions.

Member Avatar for Airshow
0
228
Member Avatar for my3h

The `shippingamount` field needs to be enabled as well as disabled. In addition, `shippingamount` field needs to be put into the correct initial state by triggering the select element's change handler on page load. jQuery : $(function() { $("select[name='type']").on('change', function(e) { $("input[name='shippingamount']").attr('disabled', $(this).val() === 'free'); }).trigger('change'); }); Raw javascript : …

Member Avatar for Airshow
0
104
Member Avatar for AHMED_DB

Are they really teaching the ternary operator `x?y:z` before `if(){...}`? Most programnmers will have learned `if()` well before the ternary. If you have learned the `Math` object then this will do it : var salesPrice = Number(prompt("Please Enter Purchase Price?", "")); var shipping = Math.max(1.50, salesPrice * 100 / 10); …

Member Avatar for Airshow
0
164
Member Avatar for SolidSora

It's better to find the image element in the DOM just once rather than every time the image needs to be changed. You can also pass objects/values into the function as parameters. This avoids having to set global variables. //this version will play once function playHomeAnimation(imageElement, n, t) { imageElement.src …

Member Avatar for Airshow
0
189
Member Avatar for softDeveloper

You can't pass elements to a page so it's not clear what you mean by "pass these elements by ajax to a javaserverpage".

Member Avatar for Airshow
0
170
Member Avatar for Suzie999

> I can capture and cancel a navigation by the onclick event by injecting "return false;" but ... You may not want to do this but it is by far the easiest approach, especially with the help of the jQuery lib, which would allow you very simply to attach an …

Member Avatar for Suzie999
0
298
Member Avatar for noelthefish

Try specifying `'json'` as $.post's 4th parameter. Without it, jQuery will make an "intelligent guess", which means it may get it wrong.

Member Avatar for Airshow
0
146
Member Avatar for Dani

Dani, I looked at the code behind the editor a couple of months ago and have to agree, it ain't the easiest to follow. I felt it needed to be taken apart and put back together in a more organised fashion. If you want to take a step back from …

Member Avatar for Airshow
0
114
Member Avatar for FutureDev86

> what am I doing wrong here? Several things, chief amongs which is that you don't need a loop when`.join()` has already reduced the array to a string and you only want "You entered the following names:" to appear once. Also, `document.write()` can be pretty evil. Used incorrectly, it will …

Member Avatar for Airshow
0
130
Member Avatar for Mike_H

Mike, This is a reasonably light adaptation of the sample code. In HTML, give your book image the attribute [ICODE]id="z_img"[/ICODE]. In javascript, [CODE=javascript] //-- change /* minValue : 10, maxValue : 110, */ //-- to minValue : 70, //minimum book width maxValue : 185, //maximum book width //-- change /* …

Member Avatar for jansiranir
0
263
Member Avatar for divsok

Divsok, > document.write() functions inside a struts form I'm struggling to understand what you might be attempting here. `document.write()` isn't the sort of statement I would normally associate with Struts. Can you provide some code please.

Member Avatar for Airshow
0
245
Member Avatar for patocardo

The `g` flag isn't relevant to `.test()` and causes problems. The following tests give a better indication of what's going on : function doTests() { var i, arr1 = [], arr2 = [], re1 = /two/g, //bad re2 = /two/, //cool str = ["one two three", "two three four", "three …

Member Avatar for Airshow
1
131
Member Avatar for mbarandao

First, let's check my understanding. You have a pair of select elements with onchange event handlers to give them a cascading behaviour and to populate a set of associated HTML elements with data. What you want is to be able to add one or more further pairs of select elements …

Member Avatar for mbarandao
0
246
Member Avatar for Designer_101

101, The solution depends on why you need to do this? If you build your table manually, then do the summation manually and type in the HTML for the totals row manually, complete with its values. If your HTML is pasted from a spreadsheed, then get the spreadsheet to do …

Member Avatar for saqlainraza14
0
44K
Member Avatar for Violet_82
Member Avatar for brightonstu93

`viewShoppingCart()` puts two new tables inot the document each time it is called, therefore the number of tables will grow and grow. You can approach this a number of ways, eg: - Ensure that `viewShoppingCart()` deletes any existing cart tables before inserting new. - Hard code your main table and …

Member Avatar for Airshow
0
218
Member Avatar for elya158

What you ideally need to do is something called "long-poling" (Google it for a definition), but Apache/JSP (in fact Apache/anything) are not best suited to a long-polling solution. You have two choices: [LIST] [*]Rhythmic polling (eg. ajax in a function invoked with setInteval). [*]Ditch Apache/JSP completely in favour of a …

Member Avatar for johannsig
0
1K
Member Avatar for riahc3

> Im kind of confused because now Im posting Articles instead of threads, posts, etc Have to agree, "article" is not a good generic term. In forums, "topic" or "thread" are the accepted terms. To most English speakers I would guess that "article" means something in a newspaper/magazine written by …

Member Avatar for Airshow
0
303
Member Avatar for DavidAntaramian

David, as far as I can tell the pattern should be good for both vars and methods but your code needs debugging. There's an error at line 70, `module.creature[i] = new Parousia.Unit();`. The error is `Uncaught exception: TypeError: 'Parousia.Unit' is not a constructor`. **Airshow**

Member Avatar for DavidAntaramian
0
237
Member Avatar for Dani

Progress === Looking good Dani. Thanks for the kbd shortcuts. Working perfectly here (Opera). Codemirror and Preview ==== I guess it was a conscious decision to go for WYSIWYG/highlighting (Codemirror) as well as a Markdown preview pane. Personally I would be happy with just the preview (that's what I'm used …

Member Avatar for Airshow
3
278
Member Avatar for jbennet

Private Messages: I read a message, decide not to reply immediately, do something else, return to my Inbox - The message has GONE! Auto-delete-on-read - surely not, never ever! This must be a bug.

Member Avatar for Airshow
0
2K
Member Avatar for WaltP

> 5) Please remove the personal avatar in the reply section. My instant reaction was that I could live with my avatar in this position but would prefer it to be at 50% opacity. That would neatly reflect the "not yet a post" status of \[text in\] the editor.

Member Avatar for Airshow
1
246
Member Avatar for Violet_82

I guess that `$overlay.hide("slow");` leaves the overlay in a different state from that in which it started life. You can try several things: * Use `$overlay.hide();` and `$overlay.show();` so as not to affect the overlay's opacity. * Ensure the overlay is reset to its original opacity by showing it with …

Member Avatar for Troy III
0
848
Member Avatar for layman114

To display the result in the DOM, first hard-code a container in your HTML, eg. `<div with id="message"></div>`. You will find it simpler to accumulate the `carvalue` strings in an array then using `.join(glue)` to put the pieces together before poking the resulting string into the DOM. ~~~ javascript $('#show').click(function() …

Member Avatar for Airshow
0
240
Member Avatar for vizz
Member Avatar for vizz
0
266
Member Avatar for mogaka
Member Avatar for Troy III
0
117
Member Avatar for felix001

Felix, Strictly speaking, that's not validation (testing); it's sanitisation (modification). Both validation and sanitisation can be performed with regular expressions as @stb says.

Member Avatar for Troy III
0
328
Member Avatar for VenusCrystal

VC, `$` is one of many non-alphabetic characters that can be used in any position in ECMAScript (javascript) variable names. It is also one of a reduced set of characters that can be used in the start position. The full rules which dictate what is legal are complex and far …

Member Avatar for Troy III
0
159
Member Avatar for doc15

`.tabs()` becomes a function with (appropriately composed) jQuery UI properly installed on the page. Either the .js resource file(s) are badly composed or don't exit or the path(s) are wrong. See [fiddle](http://jsfiddle.net/airshow/b9k7Q/)

Member Avatar for Airshow
0
212
Member Avatar for Nole_diver

A few basic things are wrong. In `codeAddress()`, the brackets and curly braces are up the swanny and one of the elses needs to go. I'm not sure this will work but at least it should load: var geocoder; var map; function initialize() { geocoder = new google.maps.Geocoder(); var latlng …

Member Avatar for Airshow
0
243
Member Avatar for trektrak

This is a bit bulky but is flexible, error tollerant and does the job: ~~~ javascript function timeCompare(d, base_d) { /* fn timeCompare : compares two dates, both of which can be passed in one of two ways. * d: (Date or String) the Date to be tested - a …

Member Avatar for trektrak
0
141
Member Avatar for singularity~
Member Avatar for Troy III
0
140
Member Avatar for vizz

In my experience intermittent service is not uncommon with Google maps', though I've not noticed a regular pattern.

Member Avatar for Airshow
0
148
Member Avatar for klemme

Try this: ~~~ var $this = $(this); var mysvar = $this.next(".svar").slideToggle(400); $this.siblings(".svar").not(mysvar).slideUp(400); ~~~ **Airshow**

Member Avatar for Airshow
0
935
Member Avatar for vizz

Hi Vizz, try: $('#navlist li').click(function(){ $(this).siblings().toggle(); }); **Airshow**

Member Avatar for Airshow
0
1K
Member Avatar for VenusCrystal

VC, You need to provide space around the small version of the icon, into which the large version will fit. This can be done by adjusting the margins in CSS: #contextual-action-icon { width: 50px; height: 30px; margin: 3px; } #contextual-action-icon:hover { width: 56px; height: 36px; margin: 0; } You may …

Member Avatar for VenusCrystal
0
140
Member Avatar for yellowSnow

Yellow, Try `str.split(/\W+/g)`. This will split at any group of one or more non-word characters. [Demo](http://jsfiddle.net/aUwRd/1/)

Member Avatar for Troy III
0
200

The End.