1,330 Posted Topics
Re: Robert, You need to somehow inhibit form submission until all AJAX calls have been satisfied. Typically, you would do this with a function attached to the form's [ICODE]onsubmit[/ICODE] event and control submission by returning [ICODE]false[/ICODE] (to suppress) or [ICODE]true[/ICODE] (to submit). Your problem now becomes how to determine whether there … | |
Re: Piet, Try this, including both 'minutes' and 'hours:minutes' presentation. [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <style> select.selectboxkl { width: 40px; } input.timedifference { width: 40px; text-align:right; } </style> <script> onload = function() { var startHSelect = document.getElementById("starttimehour"); var startMSelect = document.getElementById("starttimemin"); var endHSelect = document.getElementById("endtimehour"); var … | |
Re: Sgweaver, As I understand it, all you need to do is to ensure, on page load/reload, that your divs are correctly shown/hidden in accordance with the state of various radio buttons and pulldown menus. You should be able to get away without setting a session cookie. You can make a … | |
Re: Agr8lemon, This is pretty simple if you just want to show a single table row in response to a particular menu selection and to hide it when other selections are made. It's slightly more challenging to write efficient code that will handle [U]each[/U] menu selection to show a number of … | |
Re: Mike, Whereas you can use [ICODE]+=[/ICODE] to append html, you can't use [ICODE]-=[/ICODE] to remove it. The reason is that [ICODE]-[/ICODE] is only ever a mathemaical operator (subtract). Also, consider the case where the user has added more than one row. You probably need a mechanism to delete each row … | |
Re: Manny, I think you might want [ICODE]$("input#frmfirstForm-specializace").val($("input#frmfirstForm-specializace").val()+';;'+val));[/ICODE]. It's a bit long-winded but give it a try. [B]Airshow[/B] | |
Re: MMC, You can certainly use AJAX to get prices but another approach is to serve all price information within the page in a form that allows javascript to access it with ease. Hence you have a fast, wholly client-side application from the point the page has been served right up … | |
Re: Hi Aze, try this .... [CODE=HTML] <head> <title>HTML ders | 09.07.2010</title> <script> onload = function() { sekil = [ "bir.jpg", "iki.jpg", "uc.jpg", "dord.jpg", "bes.jpg" ]; sekil.x = 0; sekil.allowSlide = true; sekil.tim = null; sekil.slide = function() { if( !document.images || !sekil.allowSlide ) { return; } clearTimeout(sekil.tim); document.images.az.src = sekil[sekil.x]; … | |
Re: Something like this maybe : [CODE=XHTML] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type="text/javascript"> var images = []; var imgData = [ { src:"bir.jpg", title:"bir"}, { src:"iki.jpg", title:"iki" }, { src:"uc.jpg", title:"uc" } ]; //Preload images. for(var i=0; i<imgData.length; i++ ){ images[i] = new Image(); images[i].src … | |
Re: Beanryu, You said in your original post: [QUOTE=beanryu;942593]The <p> tags are created by the following js code: [CODE] paragraph = document.createElement("p"); text = document.createTextNode("first"); paragraph.appendChild(text); document.getElementById('mydiv').appendChild(paragraph); [/CODE] [/QUOTE] Therefore, you should have the means for javascript to remember the contents of these paragraphs without needing to retreive them from the … | |
Re: OS_dev, You can't change the browser's native behaviour but you may be able to write your links to force [ICODE]location="...."[/ICODE] as opposed to the behaviour you are seeing in IE7. For example: [CODE]<a href="#SectionA" onclick="location=this.href; return false;">Section A</a>[/CODE] I haven't got IE7 available at the moment so I can't test. … | |
Re: Sugumarclick, The easiest way by far to avoid the problem you are experiencing is not to have an onclick event handler associated with your table cell; find an alternative way of achieving the required action. However, if you must have this event handler, then you can still achieve what you … | |
Re: Kipl, Your code should work on the server and will do so if the .txt files have been uploaded and have the same relative path as those on your own computer. Standard unix permissions after FTP upload (644) appear to be adequate. I just tested my code (below) from a … | |
Re: On quick look, several things stand out: [CODE] var response; // xmlhttp response text //Not necessary or relevant at this point in the code. [/CODE] [CODE] if (xmlhttp.readyState==4 && xmlhttp.status==200){.....} // By performing both tests in one if(), you deny yourself the opportunity of independent elses, which is important for … | |
![]() | Re: Ashton, I'm not sure what you mean by "marquee" in this context but you seem to be describing a [URL="http://www.w3schools.com/css/pr_background-image.asp"]background-image[/URL] applied to a table. You may get cross-browser differences in exactly how it renders (viewport origin vs. element origin), so best test thoroughly. [B]Airshow[/B] ![]() |
Re: Rahul, Here's a quick test which may help shed some light : [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"> .wrapper { width: 340px; } .wrapper div { margin-bottom: 3px; padding: 5px; border: 1px solid #999; } .source { font-weight: bold; } … | |
Re: I'm not sure what you mean by "timepicker" but maybe you want something like this: [CODE] function getDate24(d) { try { return d.getHours() + ':' + d.getMinutes(); } catch(e) { return false; } } [/CODE] which returns a hh:mm string when fed with a javascript Date. If something other than … | |
Re: My guess is that [ICODE]onLoad="resizeIframeToFitContent(this)[/ICODE] fires before the AJAX request has been satisfied, so calculates new height based on the served (pre AJAX) rendering of the page. A workaround would be to get the AJAX response handler to call [ICODE]resizeIframeToFitContent()[/ICODE] as its last statement before returning. By leaving [ICODE]onLoad="resizeIframeToFitContent(this)[/ICODE] in … | |
Re: Thoughts : [LIST] [*]You would probably benefit from a formulation of [ICODE]create_request_object[/ICODE] that uses try/catch rather than testing [ICODE]navigator.appName[/ICODE]. There are many examples on the web. [*]Only kick off the update cycle after the page has loaded, otherwise a quick ajax response could generate a Javascript error and the whole … | |
Re: As far as I know this is an aspect that has not yet been addressed by the W3C. TMBK, Javascript's [ICODE]window.open()[/ICODE] has no knowledge of tabs and interpretation of the command is up to browsers (and their settings on individual computers). [B]Airshow[/B] | |
Re: Gear26926, It works fine in IE6 and may also work in the even older IE5 but won't work in any other browser unless served from google.fr . [B]Reason[/B]: Most browsers block AJAX calls to "foreign" (ie 3rd party) domains. [B]Solution[/B]: Sticking with 100% client-side code .... I wish I knew. … | |
Re: VLowe, Probably easiest to do this by lookup rather than a series of ifs. [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> var prices = { '4' : { '50' : '95.00', '75' : '103.00', '100' : '115.00', '125' … | |
Re: [QUOTE=danarashad;1191833]var id1 = document.getElementById("sid").value; var id2 = document.getElementById("sid").value; var id3 = document.getElementById("sid").value;[/QUOTE] Dan, First, just in case you dont know, the three statements will obtain exacltly the same value but I guess you have a reason. OK, there are a few of ways to do what you want. If [ICODE]id1[/ICODE], … | |
Re: Vitro, I suggest you first make a test page with hard coded HTML to eliminate any client-side uncertainty: [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"> {} </style> <script> </script> </head> <body> <form id="form1" name="form1" method="post" onsubmit="" action="manager.java"> <select name="list1"> <option value="s0">right</option> … | |
Re: You can accumulate your names/scores in a cookie if you want to but it's not necessary unless you need to remember the values between user sessions - eg. when the user shuts down the computer and starts up the next day. If you persist with the cookie, then you need … | |
Re: Rukshilag, Opening a new window to handle the print() is one way to do it but not the best IMHO. Make sure you test in a variety of browsers. Personally, I would write [ICODE]@media[/ICODE] rules into the CSS on the main page to control appearance/content of screen and print separately. … | |
Re: I think I must be addicted to form scripting. [QUOTE] 1. A selection from the list in question 3 can only be made if the user selected at least one check box in question [/QUOTE] Simple. [QUOTE] 2. If the user enters a valid value in the question 5 text … | |
Re: MS_SWS, My first thought would be "Mime Type". The server on which I hold my sites incorporates a multifaceted monster called CPanelII, which includes a "Mime Types" link on the front page. The Mime Types page shows a whole raft of defaults plus the ability to add/modify. The intro at … | |
Re: Rukshilag, Just call [ICODE]window.print()[/ICODE] from javascript, eg.: [CODE]<input type="button" value="Print" onclick="window.print();"> or <button onclick="window.print();">Print</button>[/CODE] With CSS [URL="http://www.w3schools.com/css/css_mediatypes.asp"]@media rules[/URL], you can control the print format to be different from the screen format. For example, you can suppress background images and navigation bars or choose a completely different color scheme. [B]Airshow[/B] | |
Re: nonShatter, [CODE=javascript]function setManufacturer(menu) { var field = menu.form.other_manufacturer; field.style.display = ( menu[menu.selectedIndex].value == 'other' ) ? 'inline' : 'none'; }[/CODE] [CODE=HTML] <select name="manufacturer" id="manufacturer" onchange="setManufacturer(this);"> <option value="man">--Manufacturer--</option> <option value="dell">Dell</option> <option value="ibm">IBM</option> <option value="other">Other</option> </select> <input type="text" name="other_manufacturer" size="35" value="" style="display:none;"> [/CODE] [B]Airshow[/B] | |
Re: [QUOTE=Doward;1189562]..... if you need more information, please ask![/QUOTE] Like mentioning that this is an ASP.NET question? At least, that's what I assume from the word "Gridview" :S I think you will have more luck in the ASP.NET forum. It doesn't sound like a raw AJAX/Javascript thing. [B]Airshow[/B] | |
Re: Benkus, Try this : [CODE] var url = "open.php"; var params = [ "filename=" + document.getElementById("filename").value, "extension=" + document.getElementById("extension").value, "content=" + content, "path=" + document.getElementById("path").value ].join('&');//tidier xmlhttp.open("POST",url,true);//moved up xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.onreadystatechange = saveStateChanged; xmlhttp.send(params); [/CODE] You'll see I have deleted two [ICODE]setRequestHeader[/ICODE] lines. [ICODE]"Connection", "close";[/ICODE] is wrong if you want … | |
Re: muiBob, I'm guessing that your php is fine because it works with FF etc. There is a couple of things in the javascript/HTML that may be responsible for it not working in IE. I have given the code a throrough going over, resulting in this : [CODE=HTML] <!DOCTYPE html PUBLIC … | |
Re: On [URL="http://api.jquery.com/append/"]this page of the jQuery API[/URL], we learn from a contribtor's comment that : [QUOTE="Alex Dahman"]"The documentation should state that append(), appendTo(), prepend(), prependTo() and similar jQuery functions silently remove event handlers from a HTML document fragment string."[/QUOTE] With jQuery (etc.) always consult the API. The answer, or a … | |
Re: NimaReq, There are many ways to do this. Here's one using an optional custom HTML attribute [ICODE]target[/ICODE] to designate an active cell and the id of an associated cell: [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"> #myTable { border: 1px solid … | |
Re: Mados, It took me less than a minute to "view source" and find that the slider is built with a jQuery plugin called [I]jCarousel Lite[/I], then to use google to find the [URL="http://www.gmarwaha.com/jquery/jcarousellite/"]official site[/URL] where it is well documented and available for download. That is nothing that you could not … | |
Re: I think this is an ASP question, despite its AJAX angle. I can find nothing remotely familiar or comprehensible in the code and feel that denizens of the ASP forum might fair better with it. [B]Airshow[/B] | |
Re: FXM, What is your input string [ICODE]txt[/ICODE], that gives these results? [B]Airshow[/B] | |
Re: Jake, [QUOTE=Eccentric.2005;1182384]Is there anyway of doing this? [/QUOTE] The simple answer is yes, but I have to ask if you have considered encompassing all of page2's functionality within page1? Even if the server does some complex database stuff or grabs some XML feed before serving page2, and even if page2.htm … | |
Re: Corbula, Demo: [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"> body, button, input { font-family: verdana; font-size: 10px; } .item { } .item { float:left; width: 200px; border: 1px solid #999; margin-right: 6px; } .item td, .item th { border: 1px solid … | |
Re: Dylank, Try this : [CODE=javascript] onload = function(){ var divName = 'mouseFollow'; // div that is to follow the mouse // (must be position:absolute) var followDiv = document.getElementById(divName); var offX = 15; // X offset from mouse position var offY = 15; // Y offset from mouse position function mouseX(evt) … | |
Re: This page won't work in its current form for a couple of reasons. Firstly, by using a submit button for Add Details, the form will be submitted and the page will reload. This effectively means that no entries can accumulate in the Javascript array. [B]Solution[/B]: Change "Add Details" to type="button" … | |
Re: Jimminni, Javascript would be very limited as a screen saver. Native Javascript can only affect the contents of window(s) under its control but not their chrome. It can only close subordinate windows (ie windows opened by itself). It has no general authority over other applications or the screen as a … | |
Re: sa1, I'm not sure why it's not working but you can certainly simplify your html and javascript significantly by using image replacement and a single function for all sections, as follows : [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"> .addimg { … | |
Re: Bobon, You are on the right lines. Just a few things to fix. [LIST=1] [*]You need to pass the form fields' values to the validator functions rather than the fields themselves (DOM elements). [*]Ensure that each of the individual validator functions returns true (for OK) or false (for error). Most … | |
Re: Amby, I think you will stand more chance by moving [ICODE]$('#result').html....[/ICODE] inside the success handler and JSON decode it, like this : [CODE] String.prototype.parseJSON = JSON.decode;//make sure you have the JSON lib loaded. $(document).ready(function() { $("button").ajaxStart(function() { alert('Triggered ajaxStart handler.'); }); $("button").click(function() { $.ajax({ type: "POST", dataType: 'JSON', url: "Testing.aspx/SendMessage", … | |
Re: The most obvious thing is that your httprequests are synchronous. [URL="https://developer.mozilla.org/En/Using_XMLHttpRequest"]Here[/URL], we learn that : [QUOTE=mozilla.org]XMLHttpRequest supports both synchronous and asynchronous communications. Note: You shouldn't use synchronous XMLHttpRequests because, due to the inherently asynchronous nature of networking, there are various ways memory and events can leak when using synchronous requests. … | |
Re: ms_sws, The only reliable way to test for file existance is to do it server-side in eg PHP, then build the page accordingly. If server-side programming is not available, then all is not lost because images fire either an [ICODE]onload[/ICODE] or an [ICODE]onerror[/ICODE] event in response to their [ICODE]src[/ICODE] being … | |
Re: One thing immediately jumps out at me. Case clauses don't need to be { bracketed }. Normal structure of a switch-case block statement is as follows: [CODE=javascript] switch(x) { case 1: ..... ..... break; case 2: ..... ..... break; case 3: ..... ..... break; default: ..... ..... } [/CODE] It's … |
The End.