1,330 Posted Topics
Re: Public_I, [CODE=javascript] function redirect(url) { window.location.href = url; } [/CODE] [CODE=PHP/HTML] $user = $loggedin[name]; $mail = mysql_query("SELECT * FROM 'messenger' WHERE 'reciever'='$user' ORDER BY 'id' DESC limit '8'"); while($find = mysql_fetch_array($mail)){ $id = 'expression to make redirect id for this iteration of the loop'; $url = 'whatever.php' . '?id=' . … | |
Re: Presumably the two items of data (NetAddress and NetMask) form a pair which can be delivered together in one hit on findNetworkInfo.PHP? If so, first modify findNetworkInfo.PHP to return the two data items concatenated with a unique separator: [CODE=TEXT] 99.65.165.25^255.255.255.0 [/CODE] There's no need for HTML tags because the data … | |
Re: You can sanitize the text with a simple regular expression, implemented here as a String method. [CODE] String.prototype.stripSlashes = function(){ return this.replace(/\\/g, ''); }; [/CODE] Then call the method with something like this : [CODE] ... var myTextArea = document.getElementById("myTextarea"); myTextarea.value = myText.stripSlashes(); ... [/CODE] Where [ICODE]myText[/ICODE] is your string … | |
Re: Do you mean jQuery.extend? If so, the [URL="http://api.jquery.com/jQuery.extend/"]API entry[/URL] is very clearly written. I don't think I could add anything meaningful to it. [B]Airshow[/B] | |
| |
Re: Jeansymolanza, I guess resources/process.php returns '1' or '0', which are strings not numbers, so [ICODE]html==1[/ICODE] will always return false. Try [ICODE]html=='1'[/ICODE]. [B]Airshow[/B] | |
Re: /Close tags are an HTML thing. For elements created in Javascript, they are unnecessary because the code interacts with the DOM directly by creating nodes, which are effectively both "opened" and "closed" as they are created. This is the same in all browsers. In this regard, IE is no different … | |
Re: There's a few things there. [LIST] [*]You need just one [ICODE]$(document).ready ...[/ICODE] structure containing both sets of .live() code (or whatever else is necessary for the page to work). [*]Avoid embedding javascript in HTML. Attach event handlers to DOM elements in javascript, inside the [ICODE]$(document).ready ...[/ICODE] structure. [*][ICODE]ajax_live_slidetoggle.php[/ICODE] includes HTML, … | |
Re: JAJoe, Javascript is completely dumb when it makes an ajax request by whatever means (d.i.y. or with jQuery, Prototype etc). It submits a URL in the same way as the browser would if you typed the same url into its address bar and clicked GO. There's no native client-side filtering … | |
Re: First thing to check the DOCTYPE. Make sure it's the same as the javascriptkit example page. With luck, that'll fix it. [B]Airshow[/B] | |
Re: If you want to do the same thing in Javascript, then it might be something like this: [CODE] function tryme(mycell) { var mysum = 0; var myStrings = ["AIJQY", "BKR", "CGLS", "DMT", "EHNX", "UVW", "OZ", "FP"]; for(i=0; i<mycell.length; i++) { var mytest = mycell.charAt(i).toUpperCase(); for(j=0; j<myStrings.length; j++) { if( myStrings[j].indexOf(mytest) … | |
Re: Neither I nor my browser recognizes [ICODE]delete [] bigArray;[/ICODE] as a valid line of javascript. In which environment does it work Fansico? [B]Airshow[/B] | |
Re: I've never done it but here is where I would start : [url]http://code.google.com/apis/maps/documentation/javascript/[/url] More icons here: [url]http://code.google.com/p/google-maps-icons/[/url] [B]Airshow[/B] | |
Re: C&A Try this: [CODE] function scrollObj(cssAttr, delta, interval) { var $this = $(this); if($this.attr('allowScroll')) { var r = parseInt($this.css(cssAttr)); $this.css(cssAttr, r+delta); var that = this;//capture "this" in closure for use in the timeout function. setTimeout(function(){scrollObj.call(that, cssAttr, delta, interval);}, interval); } } $('#button').hover( function() {//executes when the mouse pointer enters the … | |
Re: Vishal, As it says in the jQuery API, [ICODE]jQuery.remove()[/ICODE] returns [ICODE]jQuery[/ICODE], so you can do something like this: [CODE=javascript] var x = $('#myDiv').remove(); //....... $('#myElement').append(x);//or .after() or .prepend() depending on how you need to insert x back into the DOM. Of course, like any javascript member, x must be in … | |
Re: For me that Google Maps page prints out standard print header and footer as established in each browser (IE, FF and Opera). Google may well have included something which attempts (and succeeds in your browser) to control the print, but it would appear not to be a universal solution. [B]Airshow[/B] | |
Re: To add width and height into the options hash .... [CODE] jQuery(document).ready(function($){ var $anchors=$('a[rel="enlargeimage"]') //look for links with rel="enlargeimage" $anchors.each(function(i){ var options = {}; var rawopts = this.getAttribute('rev').split(','); //transform rev="x:value1,y:value2,etc" into a real object for (var i=0; i<rawopts.length; i++){ var namevalpair=rawopts[i].split(/:(?!\/\/)/); //avoid spitting ":" inside "http://blabla" options[jQuery.trim(namevalpair[0])]=jQuery.trim(namevalpair[1]); } options.width = … | |
Re: Sounds quite involved. I could write it but it would require some time to develop. [B]Airshow[/B] | |
Re: I've not yet looked into GWT very deeply but the following statement is revealing: [QUOTE=Google]The GWT SDK provides a set of core Java APIs and Widgets. These allow you to write AJAX applications in Java and then compile the source to highly optimized JavaScript that runs across all browsers, including … | |
Re: Frankey, Change [CODE] var panelIds = $links.map(function(){ return this.hash; }).get().join(","), //to var panelIds = $links.map(function(){ return (this.getAttribute('rel')) ? this.getAttribute('rel') : this.hash; }).get().join(","), [/CODE] and [CODE] var height = $panels.hide().filter(link.hash).css('opacity',1).show().height() + heightOffset; //to var panelId = (link.getAttribute('rel')) ? link.getAttribute('rel') : link.hash; var height = $panels.hide().filter(panelId).css('opacity',1).show().height() + heightOffset; [/CODE] I only tested … | |
Re: Winky, I expect your reqDate3 is "2010,11,15" which is a string of digits and commas. Passing this string to [ICODE]new Date()[/ICODE] is not the same as [ICODE]new Date(2010,11,15)[/ICODE], in which three numbers are passed. Starting with [ICODE]d = "11/15/2010"[/ICODE], you create a date as follows: [CODE] var d = "11/15/2010";//the … | |
Re: You need to give the img2 float something of width:200px to rest aginst, then reduce its width in the animation. Insert above the second html block [CODE]<div id="rightFiller" style="float:right;width:200px;"> </div>[/CODE] Animate with : [CODE]$(document).ready(function() { $(".font1").click(function() { $("#rightFiller").animate({width : "0px"}, "slow"); }); $(".font2").click(function() { $("#rightFiller").animate({width : "200px"}, "slow"); }); });[/CODE] The … | |
Re: Myl, You can do something like this (it's very rudimentary) .... [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Untitled</title> <style type="text/css"> </style> <script> function TriCheckBox(elementID){ if(!elementID) { return null; } var el = document.getElementById(elementID); var tri = document.createElement('span'); el.parentNode.replaceChild(tri, el); tri.style.border = '1px solid … | |
Re: Piet, I think I have it. In the datepick settings, change [ICODE]onDate: nationalDays[/ICODE] to [ICODE]onSelect: nationalDays[/ICODE]. Then nationalDays should be as follows: [CODE]function nationalDays(dates) { var natDate; var includesNatDate = false; for (i=0; i<natDays.length; i++) { d = $.datepick.newDate(natDays[i][2], natDays[i][0], natDays[i][1]); if(d.getTime() >= dates[0].getTime() && d.getTime() <= dates[1].getTime()) { includesNatDate … | |
Re: Or how about 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></title> <style type="text/css"> #menuWrapper { width:300px; padding:5px; border:2px dashed #336699; } #menuWrapper h1 { margin:0; color:#fff; background-color: #006699; } #menuWrapper h1, #menuWrapper .c1 { text-align: center; } #menuWrapper p { margin: 6px 0; } #menuWrapper … | |
Re: Mossa, Here's a bunch of ideas: First, a couple of utilites that will help keep the volume of code down - add immediately after your jquery script. [CODE] <script> Number.prototype.toCurrency = function() { return "$" + this.toFixed(2); }; String.prototype.fromCurrency = function() { return Number(this.replace("$","")); }; </script> [/CODE] Next, apply [ICODE]Number.toCurrency()[/ICODE] … | |
Re: Matthew, First, convert your code into a function : [CODE=javascript]function calc() { //your statements go here }[/CODE] Now add this below the function : [CODE=javascript] onload = function() {//perform the following statements after the page has loaded var c = document.getElementById('calculator');//find the "Calculator" button c.onclick = calc;//run the "calc" function … | |
Re: Rajeesh, Here's a little demo using techniques I find reliable. [CODE=html] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Untitled</title> <style type="text/css"> #mainImageWrapper { width: 200px; height: 200px; border: 1px solid #000; background-color: #e0e0e0; float: left; } #mainImage { display: none; width: 200px; height: 200px; border: … | |
Re: CuteKate, In the context you use it, [ICODE]this.value[/ICODE] is unreliable. Try [ICODE]this[this.selectedIndex].value[/ICODE] instead (in 3 places). [B]Airshow[/B] | |
Re: nadskap2, Several things jump off the page. Function update has a 1 second (1000 ms) timeout before giving up and refreshing the page. This seems unnecessarily short even for fast intranet scenarions (though maybe ok for testing with server on local machine). Functions loadManageNews and loadManageNav both use [ICODE]url[/ICODE], which … | |
Re: QWaz, You need to post the code that causes detailes to appear. Unable to advise without it. [B]Airshow[/B] | |
Re: ppohlmann, It's much easier to pass (a reference to) the form itself rather than its id. For example: [CODE=html]<form ..... onsubmit="function Setradio(this);"> <!--or--> <input type="button" ..... onclick="Setradio(this.form)">[/CODE] [CODE=javascript] function Setradio(f){ var oucombinedscore = 0; oucombinedscore=parseFloat(f.pickscorehome.value) + parseFloat(f.pickscorevisitor.value); //etc etc .. } [/CODE] [B]Airshow[/B] | |
Re: Aventurine, First, implement the solution I gave you to your earlier topic. It addresses much of what you are asking. [B]Airshow[/B] | |
![]() | Re: Hi Ardav, How's it going? This may work: [CODE] var cnt = 1; var blocks = $("#yearblocks").val(); var week_starts = []; while (cnt <= Number(blocks)) { eek_starts.push($('#week_start_' + cnt).val()); cnt++; } var data = { step : "2", weeks : blocks, week_starts : week_starts }; $.post("includes/receive.php", data , function(msg){ ...(etc)... … |
Re: AcTw, There are much easier ways to coordinate the playing of multiple sound files (and other multimedia) than to use JavaScript. Personally, I would write and serve a Synchronized Multimedia Integration Language (SMIL) file. I can't recall all the details as I haven't used SMIL for some years now, but … | |
Re: Aventurine, At least part of the problem is that the hidden unit_price fields don't have values. That needs to be fixed. But we can go much further to avoid unnecessary complexity in building the page, plus a go-faster goodie. The JavaScript function [ICODE]sumtot[/ICODE] can be hard-coded as follows : [CODE] … | |
Re: T_G, Maybe you want something like this: [CODE=CSS] #MM { list-style-type: none; } #MM li { display: inline; position: relative; margin-right: 5px; } #MM li a { text-decoration: none; } #MM li a img { position:absolute; left: 0; top: 25px; display: none; width: 150px; border: 1px solid #000; } [/CODE] … | |
Re: Avi, I've not checked the PHP or the XML handling logic, but I have had a hack at the overall javascript structure for you. [CODE=javascript] function getXmlHttpObject() {//By having this as a separate function, it becomes reusable for any other ajax you might have (one day) on the same page. … | |
Re: Everything Tay says plus .... Array.sort() accepts a callback function as an argument, allowing you to define exactly how the sort is executed in terms of the sort criterion and sort direction. First, store your results in an object as follows: [CODE=javascript] resultsArray.push({ lastName : lastName, firstName : firstName, score … | |
Re: Whaaaaaaat! This solution is completely and utterly unpredicatable from anything that preceded it and, for me, asks far more questions than it answers. "Why" is just the starter. [B]Airshow[/B] | |
Re: This tutorial is a good place to start [url]http://www.w3schools.com/js/default.asp[/url] W3schools in excellent resource for learning and reference. Later, when you get more advanced, you should read everything you can by [URL="http://www.crockford.com/"]Douglas Crockford[/URL] (and watch his videos). The written material is in English but some of it is also available in … | |
Re: Microsoft's [URL="http://msdn.microsoft.com/en-us/library/ms531384(v=VS.85).aspx"]Data Binding Architecture[/URL] may help. You will need to explore whether you can bind directly to Excel Worksheets. I guess that the CSV equivalents would be more assured but that could be automated if necessary. I have never tried this and don't know anyone who has. [B]Airshow[/B] | |
Re: Matthew, You could try to install a working example of [ICODE]add_meta_box[/ICODE] (eg. [URL="http://codex.wordpress.org/Function_Reference/add_meta_box"]this one[/URL]), then set about modifying it to your own specification. I don't pretend to understand everything in the example, but it would appear that downstream client-side and server-side handling is managed automatically. [B]Airshow[/B] | |
Re: SteelShark, The answer is Yes, but it's not a JavaScript/DHTML/AJAX question. Permanent reduction of full-sized images to make thumbnails is a server-side thing performed by (or via) eg. JSP/PHP/CGI - whichever is available to you. You can, of course, serve unreduced full-sized images and use them as thumbnails by rendering … | |
Re: Adand, At least part of the problem might be : [CODE] function gameTime(){ getPicks(); [COLOR="Green"]document.forms["submitChoice"].submit();[/COLOR] publishWall(); } [/CODE] The line [ICODE]document.forms["submitChoice"].submit();[/ICODE] will submit conditional only on the [ICODE]document.forms["submitChoice"][/ICODE] not equating to [ICODE]null[/ICODE] (in which case an error would be thrown). Even if the form has an [ICODE]onsubmit[/ICODE] handler (intended to … | |
Re: Mduncan8, I'm pretty certain you need something called an "Event Router". An Event Router establishes for a particular event, an "observer" - a function which is a member of a javascript object with a private array of "listeners" (functions you wish to run whenever the event fires) and a couple … | |
Re: QWaz, Something like this maybe: [CODE=HTML] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Untitled</title> <style type="text/css"> #explainWrapper { width: 300px; height: 60px; padding: 2px; border: 2px solid #336699; } .explain { display: none; font-family: verdana; font-size: 10pt; } .explain h2 { margin: 0; background-color: #336699; … | |
Re: Daved83, It's very hard to know what might be going on in the absence of your code. It is quite acceptable on Daniweb to post it but please remember to wrap it in code-tags. Personally, I would start by looking at the client-side code; the AJAX call and its response … |
The End.