1,330 Posted Topics

Member Avatar for Behseini

Behseini, I think you can achieve what you want with a combination of [iCODE].slideToggle[/iCODE] and [iCODE].slideUp[/iCODE], without any conditional statements. [CODE] $(document).ready(function(){ $(".login").click(function(){ $(".panel").stop().slideToggle("slow"); $(".panel2").stop().slideUp("slow"); }); $(".register").click(function(){ $(".panel").stop().slideUp("slow"); $(".panel2").stop().slideToggle("slow"); }); });[/CODE] This gives each link a toggle action for its own panel, whilst ensuring that the other panel is hidden. …

Member Avatar for Behseini
0
151
Member Avatar for muralibobby2015

Muralikalpana I have seen this before. Google maps don't initialise properly in a hidden element. You must ensure that [iCODE]canvas[/iCODE] is showing when [iCODE]new google.maps.Map(canvas, options)[/iCODE] is called. [B]Airshow[/B]

Member Avatar for Airshow
0
1K
Member Avatar for ChrisJ

Chris, it's always worth asking but Javascript/DHTML/AJAX is probably not the best place. Looking through the Daniweb forum titles, there's not one specifically for server setup/config but would have thought [I]Web Development > Configuring Readymade Scripts[/I] is better than here. [B]Airshow[/B]

Member Avatar for Airshow
0
54
Member Avatar for newbie14

[QUOTE=TySkby;1594777]Another solution(which would be a bit more advanced) would be to incorporate some Ajax functionality into your existing buttons, so that when they're clicked they make a call to a PHP script that saves the current form data to mysql, and then when it calls back successfully, you go ahead …

Member Avatar for Troy III
0
521
Member Avatar for gertails

For completeness ..... HTML's <del>...</del> and <ins>...</ins> are included for use as editorial "laymarks". I have never used either of them. There's also a very old, now deprecated, tag <s>...</s> for strikethrough. Whilst <del> generally results in a single strikethrough, W3C leaves it open as to how <del> (and <ins>) …

Member Avatar for Ezzaral
-1
675
Member Avatar for dantheman50_98

[QUOTE=dantheman50_98;1593538]... wrapped in its own script tags, and is it directly related to the script beneath it? Can I put these both in their own external js file? [/QUOTE] Yes but they don't logically belong together. The statement [ICODE]$j = jQuery;[/ICODE] belongs with whatever statements use $j. It is more …

Member Avatar for dantheman50_98
0
302
Member Avatar for apanimesh061

Apanimesh, You appear not to have a mechanism for propagating the count value from refresh to refresh. You can't maintain the counter on the page, either in the DOM or in javascript, because the whole environment gets wiped out when the page is refreshed. There are two basic ways to …

Member Avatar for karthik_ppts
0
209
Member Avatar for apanimesh061

[QUOTE=apanimesh061;1593047]I am sorry ! I could not get meaning of 'focus' mainly in case of Javascript .... Moreover what kind of focus is it talking about ?? I would be glad if you could elaborate.[/QUOTE] Various elements in a browser page (including the page itself) take "focus" when they are …

Member Avatar for stbuchok
0
202
Member Avatar for apanimesh061

It's just a question of which events fire on the img element. You may find differences between browsers. [B]Airshow[/B]

Member Avatar for Troy III
0
98
Member Avatar for tunde011

Tunde, Make sure that cal_current_date is always authoritative. Change its value with eg. .setMonth(), .setDay, .setDate(), .setYear() when next/prev buttons are clicked. Don't rely on other variables. [B]Airshow[/B]

Member Avatar for Airshow
0
325
Member Avatar for rowly

Rowly, The error message makes me suspicious that FF doesn't like the javascript: url. I guess you're using : [CODE=html] <a href="javascript:Newitem2(...);">...</a> [/CODE] Whereas I'm not aware of FF having a problem with this construction, you might like to try: [CODE=html] <a href="#" onclick="Newitem2(...);return false;">...</a> [/CODE] Even better, attach your …

Member Avatar for Airshow
0
219
Member Avatar for grabit

Grabit, The page has major structural problems. It has several <!DOCTYPE>s, each with its own <html><head>...</head><body>...</body></html> structure. There's also a <tittle> above the first <!DOCTYPE>. Various blocks of markup/javascript/css are repeated in each structure. It looks like the page is pulled together by including a bunch of self-contained web pages …

Member Avatar for Airshow
0
269
Member Avatar for chompchomp

Chompchomp, I can see nothing in your javascript that should cause FF to behave differently from the other browsers. We therefore have to be suspicious that the loaded content might be to blame. I would be inclined to find a solution not involving an iframe if possible. In my experience, …

Member Avatar for chompchomp
0
295
Member Avatar for superbass

Assuming the php delivers what is expected, try [iCODE]http.responseHTML[/iCODE] instead of [iCODE]http.responseText[/iCODE], ie.: [CODE] results = http.responseHTML.split(","); [/CODE] By the way, you could avoid the cumbersome string-building in php by making $textout an array, pushing the data elements onto it in turn, then echoing [iCODE]implode(",", $textout);[/iCODE]. This avoids the need …

Member Avatar for superbass
0
175
Member Avatar for Mujahid158

I'm a bit in the dark here in that I don't fully understand the nature of the conversion. I'm struggling with the question, "how can I do it in wordpress using slice and split". Wordpress is a PHP application. Javascript runs client-side. Are you seeking to do something server-side that …

Member Avatar for Troy III
0
130
Member Avatar for jamojo

Jamojo, I don't normally encourage people to use a javascript lib but your problem is fairly difficult in standard javascript and very simple in jquery, as you will see below. I think this is what you want: [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> <meta …

Member Avatar for Airshow
0
2K
Member Avatar for dhruv_arora

Remember to declare local variables (inside functions), otherwise you will create globals: [CODE] function addHead(level){ var html='H'+level; var text=this.toString(); var start="<"+html+">"; var stop="</"+html+">"; return start+text+stop; } [/CODE] Even better, do it in one line; local variables not required: [CODE] function addHead(level){ return "<h%s1>%s2</h%s1>".replace(/%s1/g,level).replace("%s2",this.toString()); } [/CODE] [B]Airshow[/B]

Member Avatar for dhruv_arora
0
174
Member Avatar for ofir0803

ofir, Your code looks like it should work providing jquery is installed on the page. The version below applies zebra stripes only to tables with [iCODE]class="zebraStripes"[/iCODE], and applies the [iCODE]:odd[/iCODE] selector more efficiently. [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"> .paint { background-color: …

Member Avatar for twiss
0
1K
Member Avatar for subhra44

In general, the following are equivalent in javascript: [LIST] [*]object.x.y.z [*]object['x']['y']['z'] [/LIST] Your two statements may or may not both select the same document node. I think the first version is more likely to be successful, not because of its syntax but because it addresses the collection [ICODE]document.forms[/ICODE]. [ICODE]document.myForm...[/ICODE] may …

Member Avatar for urtrivedi
0
210
Member Avatar for astnrocker

Your two nested loops both iterate from 0-10; ie. 11 iterations. For 10 rows/columns, either iterate from 0-9 or 1-10. [B]Airshow[/B]

Member Avatar for Airshow
0
103
Member Avatar for Tellalca

Tellalca, [iCODE]String.search[/iCODE] expects its argument to be a regular expression. Try [iCODE]String.indexOf[/iCODE] instead, with arguments ("@") and (".") as you were trying. [B]Airshow[/B]

Member Avatar for Airshow
0
107
Member Avatar for bangla
Member Avatar for matricol

Notepad++ has an "as-you-type" auto-indent feature. It doesn't convert previously written code (at least not without lots of manual interaction, which is tantamount to doing it yourself). I've not used it but understand that Eclipse's auto-indent tends to be well liked but may offer nothing more that Notepad++. [B]Airshow[/B]

Member Avatar for Tellalca
0
150
Member Avatar for jssutton11

I expect you find that "Duck Sauce" and "No Sleep" are OK but the others are not? If I'm right then it's to do with editplayer()'s arguments, ie. the ids generated by [iCODE]foreach ($temp as $id)[/iCODE]. [CODE=javascript] editPlaylist(6); //ok, argument is a number editPlaylist(R); //will generate a javascript error unless …

Member Avatar for jssutton11
0
183
Member Avatar for oggiemc

Yes, exactly so. The if clause is a "safety wrapper" to ensure the method is called only if it exists. [B]Airshow[/B]

Member Avatar for Airshow
0
135
Member Avatar for vedmack

I can only think that you have to reattach the onclick handler to the td after calling transformNode. [B]Airshow[/B]

Member Avatar for Airshow
0
100
Member Avatar for aPPmaSTer

aPPmaSTer, [iCODE]mySelectMenu.value[/iCODE] is not universally understood. Use the longwinded [iCODE]mySelectMenu[mySelectMenu.selectedIndex].value[/iCODE] instead. Try this: [CODE] function doit() { var model = document.getElementById("model"); var list1 = document.getElementById("list1"); var list2 = document.getElementById("list2"); var list3 = document.getElementById("list3"); if(model && list1 && list2 && list3) { var val = model[model.selectedIndex].value; list1.style.display = (val == "standard") …

Member Avatar for matricol
0
138
Member Avatar for astnrocker

AstnRocker Easiest way is to control spacing in the HTML with table attributes, eg: [CODE] document.write("<table cellpadding=\"5\" cellspacing=\"2\" border=\"1\">" + tblHTML + "</table>"); [/CODE] Cellpadding and cellspacing add vertical as well as horizontal spacing. Alternatively, you can use CSS, which gives more control, eg: [CODE] <style> td { padding: 3px …

Member Avatar for Airshow
0
193
Member Avatar for saadi06

Saadi, The simplest solution is to replace the entire menu from <select ...> to </select>. You can either build the menu like this in php or "top and tail" the options string in the ajax success handler. If you don't already have an addressable container, then wrap the original menu …

Member Avatar for Airshow
0
487
Member Avatar for jiten_raulo

jiten_raulo, You can further exploit jquery, chiefly by attaching the onclick handler to the checkboxes, which simplifies the HTML and the script. [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> form { margin: 12px 0; } #myImages a { visibility: hidden; } #myImages img { …

Member Avatar for Airshow
0
290
Member Avatar for BaSk

The traditional/safe way to do this is by using good old steam-age HTML; no need for any javascript. Exercise your php skills to build the select menus with the attribute [ICODE]selected="selected"[/ICODE] for the required option. For example, for a user whose profile says "Canada": [CODE=HTML]<select name="country" id="country"> <option value="">Select Country</option> …

Member Avatar for Airshow
0
174
Member Avatar for anandhikrishnan

Anandhikrishnan, Dynamically rewriting a stylesheet is not generally the preferred approach. It is complex (as evidenced by the code you posted) and not always reliable (as you have found). It is far easier to change the style properties of all elements currently styled with the relevant style direcitve. A potential …

Member Avatar for Airshow
0
197
Member Avatar for ibn_sumal

Ibn, Post your whole test page. There's got be an error in it somewhere. [B]Airshow[/B]

Member Avatar for Luckychap
0
1K
Member Avatar for jonsan32

Jonsan, Reading between the lines here, I think you want something that is part algorithmic and part lookup (to accommodate a discount structure). Therefore, the rate per player per workout is to be discovered by lookup, but the other two values are to be calculated, based on the lookup value. …

Member Avatar for jonsan32
0
228
Member Avatar for avocado_juice

Avocado_juice, Now I have read stbuchok's answer, I think I better understand the problem however I would approach it differently, without needing to use a popup window. Assuming you already have the means to get the scan process to populate an HTML <input> field, then all you need is a …

Member Avatar for avocado_juice
0
3K
Member Avatar for ya.basha

ya.basha, Try [URL="http://raphaeljs.com/"]Raphaël[/URL] or [URL="http://jsdraw2d.jsfiction.com/"]jsDraw2D[/URL] [B]Airshow[/B]

Member Avatar for ya.basha
0
1K
Member Avatar for divyakrishnan

This sort of thing is easily achieved with jQuery. [CODE] $("#firstdrop").find("select").clone().appendTo($("#seconddrop")); //where id="seconddrop" is a block element (eg. div) or inline element (eg. span). [/CODE] Any attached event handlers will be attached to the clone automatically. I'm not sure about the current selectedIndex. It probably reverts to zero in the …

Member Avatar for Airshow
0
2K
Member Avatar for clbembry

A reliable 800 millisecond poll across the internet is a big ask. On a private LAN, with a single IP packet in each direction, optimised dedicated server-farm for load sharing, optimised sql, a compiled servlet rather than an interpreted script, and with all client computers in some sort of non-interruptive …

Member Avatar for Airshow
0
105
Member Avatar for alxrite

alxrite, I think what you want is quite easy but I'm finding it difficult to understand what each table and each "collection" comprises. Can you post one collection's worth of HTML please? [B]Airshow[/B]

Member Avatar for Airshow
0
65
Member Avatar for katties

As far as I know there's no particular issue with [iCODE]* 0.5[/iCODE], however when performing any arithmetic calculation, javascript can give unexpected (imprecise) results due to all numbers being floating point. There's no such thing as a genuine, guaranteed integer value as exists in most programming languages. The good news …

Member Avatar for katties
0
119
Member Avatar for jaycastr

[CODE=javascript] location.href = 'view_results.php?month=' + month + '&program=' + program; [/CODE] It's sometimes convenient to build the string like this: [CODE] var querystring = []; querystring.push('month=' + month); querystring.push('program=' + program); location.href = 'view_results.php?' + querystring.join('&'); [/CODE] [B]Airshow[/B]

Member Avatar for Airshow
0
113
Member Avatar for agrarian

Agrarian, [iCODE]eval[/iCODE] should be avoided and is generally unnecessary. Easiest thing is to use the tree names as properties of an object: [CODE] var arTreePrefixes = ['boxe', 'warn', 'safe', 'indi', 'desc', 'dosa', 'stud'];// etc. var arTrees = {};//new Object for (var i=0; i<arTreePrefixes.length; i++) { var treeName = arTreePrefixes[i] + …

Member Avatar for Airshow
0
161
Member Avatar for doctorphp

drPHP, I only looked at the javascript, which (barring errors on my part) would be better phrased as follows: [CODE] $(function() { //find all required dom elements var $form = $(form).eq(0); var $first_name = $('[name="first_name"]'); var $last_name = $('[name="last_name"]'); var $reply = $('[name="reply"]'); var $flash = $("#flash"); var $post_reply = …

Member Avatar for Airshow
0
155
Member Avatar for seblake

Steve, [CODE]function product(a,b) { return a*b; }[/CODE] is equivalent to [CODE]function product(a,b) { var c = a*b; return c; }[/CODE] And there's nothing to prevent you writing the function that way. The line [iCODE]var c = a*b;[/iCODE] works as follows: [LIST=1] [*]performs the calculation and stores the result in a …

Member Avatar for Airshow
0
121
Member Avatar for raghujosh

The only obvious problems are: [LIST] [*]unbalanced quotes [ICODE]<td align="right"">[/ICODE](twice) [*]unbalanced tags [ICODE]<form><table> ... </form></table>[/ICODE] [/LIST] But, for me, neither of these prevents the validation function working. Try saving the page locally with .html extension and without the <%@ page ... %> directive and see if that makes a difference. …

Member Avatar for Airshow
0
1K
Member Avatar for Joe34

Joe, I think you just need a some safety conditions to avoid errors. Personally I would write the code 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 xmlns="http://www.w3.org/1999/xhtml"> <head> <script type='text/javascript'> var currentId; function edit_div(id){ var addnew = document.getElementById("addnew"); if(addnew){ addnew.style.display = 'block'; currentId = …

Member Avatar for Airshow
0
223
Member Avatar for Soben

Try doing the whole thing in jquery rather than hybrid code: [CODE=javascript] function showContent(x){ var $cont = $("#content"); $cont.slideUp("slow", function(){ $.ajax({ url: x + ".txt", type: "GET", success: function(data){ $cont.html(data).slideDown("slow"); } }); }); } [/CODE] [I](untested)[/I] Note that [iCODE]$cont---.slideDown("slow");[/iCODE] is inside the success function to give the desired effect (I …

Member Avatar for xylude
0
203
Member Avatar for lifeworks

It sounds like you are describing a "sprite". Sprites are well explained on the web, so I won't try to add anything here. Try googling "sprite javascript css". [B]Airshow[/B]

Member Avatar for Airshow
0
92
Member Avatar for uselessninja

[QUOTE=uselessninja;1579155]uhmm.... can u teach me how to set up that in html?... have 1 button and 2 textbox (1 textbox is where u input a number then the 2nd is to display the result) thankzz so much^^[/QUOTE] Is that not exactly the same as the demo? [B]Airshow[/B]

Member Avatar for uselessninja
0
162
Member Avatar for rents

Rents, I have used your requirement as a long overdue exercise in writing a jQuery plugin; something I've not done in earnest before. Try this: [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> <style> #mydiv1 { height: 150px; margin-top:12px; padding: 10px; border: 1px solid #000000; } …

Member Avatar for rents
0
139

The End.