JavaScript - Problems Looping Createelement And Appendchild - First One Perfect But...
Please delete, someone had a retard moment
Similar Tutorialsimport java.util.Scanner; import java.util.Arrays; /*********************************************************** * WordGuess game is a Hangman like game for two (or more) * players. This is a two player version *The game of Hangman involves one player making a word and a second * player guessing the word by guessing each letter in turn. If the guessing *player cannot get it in 6 (or so depending on the version) tries, the other *player wins. If the guesser gets it in the requisite number of tries, then the *guesser wins. This is a variant of the Hangman game involving two players *guessing against each other. * * * @author JavaFish * @I can't seem to get my loop working....it's not behaving like i want it to. ***********************************************************/ public class WordGuess { private Scanner kb; // use for all keyboard entry private Player player1; // first player private Player player2; // second player private WordBank wordList; // the dictionary to use /* alternate instance variable for the players deactivate the individual players if you choose to use this version. */ // private Player[] players; /********************************************************* * Explicit value constructor that builds a random dictioinary * * @param player1 The name of player1 * @param player2 The name of player2 ********************************************************/ public WordGuess(String player1, String player2) { wordList = new WordBank(); wordList.getWord(); this.player1 = new Player(player1); this.player2 = new Player(player2); } /********************************************************* * Explicit value constructor that builds a seeded dictioinary * * @param player1 The name of player1 * @param player2 The name of player2 * @param seed The seed to pass to WordBank constructor ********************************************************/ public WordGuess(String player1, String player2, long seed) { wordList = new WordBank(); wordList.getWord(); this.player1 = new Player(player1); this.player2 = new Player(player2); } /********************************************************* * play game plays the game until one player reaches 10 wins *********************************************************/ public void playGame() { boolean loopControl; boolean loopControlOne; boolean loopControlTwo; boolean playerTurn; boolean startOver; String playerInput; char playerCheck; String checkProgress; String checkGuess; String word; char[] dashes; char[] wordLetters; char[] lettersGuessed; kb = new Scanner(System.in); startOver = true; loopControl = true; playerTurn = true; System.out.printf("Welcome to Word Guess %s and %s\n\n", player1.getName(), player2.getName()); if (loopControl) { startOver = true; word = wordList.getWord(); dashes = new char[word.length()]; wordLetters = new char[word.length()]; lettersGuessed = new char[6]; for(int i = 0; i < word.length(); i++) { dashes[i] = ('-'); wordLetters[i] = word.charAt(i); } System.out.print('-'); if(startOver) { checkGuess = new String(lettersGuessed); checkProgress = new String(dashes); loopControlOne = true; loopControlTwo = true; if(playerTurn) { loopControlOne = false; } if (loopControlOne) checkGuess = new String(lettersGuessed); checkProgress = new String(dashes); playerTurn = true; { for(int i = 0; i < word.length(); i++) { System.out.print(dashes[i]); } System.out.print("\nUsed letters: "); for(int i = 0; i < 6; i++) { if(lettersGuessed[i] != 0) { System.out.print(lettersGuessed[i] + " "); } } System.out.printf("\n%s, guess a letter. ", player1.getName()); // Gets the players input and assigns it to variable playerInput playerInput = kb.nextLine(); playerCheck = playerInput.charAt(0); playerInput = new String("" + playerCheck); System.out.println(); for(int i = 0; i < word.length(); i++) { if(playerCheck == wordLetters[i]) { dashes[i] = playerCheck; } } if(checkGuess.contains(playerInput)) { System.out.printf("%s is already guessed. %s, you lose your turn.\n", playerInput, player1.getName()); loopControlOne = false; } else if(word.contains(playerInput)) { for(int i = 0; i < word.length(); i++) { if(wordLetters[i] == playerCheck) { dashes[i] = playerCheck; } } if(checkProgress.contains("-")) { System.out.printf("Correct: %s go again.\n", player1.getName()); for(int i = 0; i < 6; i++) { if(lettersGuessed[i] != 0) { lettersGuessed[i] = playerCheck; i = 6; } Arrays.sort(lettersGuessed); } } else { System.out.printf("Correct. %s you win a point!\n", player1.getName()); System.out.println(word); player1.iWon(); System.out.printf("%s: %d\t%s: %d\n\n", player1.getName(), player1.getScore(), player2.getName(), player2.getScore()); startOver = false; if(player2.getScore() == 5 || player1.getScore() == 5) { System.out.print("Game over. %s wins!\n"); loopControl = false; loopControlTwo = false; } // Set up new loop that clears everything. } } else { System.out.printf("Incorrect. %s, you lose your turn.\n", player1.getName()); loopControlOne = false; for(int i = 0; i < 6; i++) { if(lettersGuessed[i] == 0) { lettersGuessed[i] = playerCheck; i = 6; } Arrays.sort(lettersGuessed); } } } if (loopControlTwo) { checkGuess = new String(lettersGuessed); checkProgress = new String(dashes); playerTurn = true; for(int i = 0; i < word.length(); i++) { System.out.print(dashes[i]); } System.out.print("\nUsed letters: "); for(int i = 0; i < 6; i++) { System.out.print(lettersGuessed[i] + " "); } System.out.printf("%s, guess a letter. ", player2.getName()); // Gets the players input and assigns it to variable playerInput playerInput = kb.nextLine(); playerCheck = playerInput.charAt(0); playerInput = new String("" + playerCheck); for(int i = 0; i < word.length(); i++) { if(playerCheck == wordLetters[i]) { dashes[i] = playerCheck; } } if(checkGuess.contains(playerInput)) { System.out.printf("%s is already guessed. %s, you lose your turn.\n", playerInput, player1.getName()); loopControlTwo = false; } else if(word.contains(playerInput) && checkProgress.contains("-")) { { System.out.printf("Correct: %s go again.\n", player2.getName()); for(int i = 0; i <6; i++) { if(lettersGuessed[i] != 0) { lettersGuessed[i] = playerCheck; i = 6; } } Arrays.sort(lettersGuessed); } } else if(word.contains(playerInput)) { System.out.printf("Correct. %s you win a point!\n", player1.getName()); System.out.println(word); player1.iWon(); System.out.printf("%s: %d\t%s: %d\n\n", player2.getName(), player2.getScore(), player1.getName(), player1.getScore()); loopControlTwo = false; if(player2.getScore() == 0 || player1.getScore() == 0) { System.out.print("Game over. %s wins!\n"); loopControl = false; } } else { System.out.print("Incorrect. %s, you lose your turn.\n"); loopControlTwo = false; for(int i = 0; i < 6; i++) { if(lettersGuessed[i] == 0) { lettersGuessed[i] = playerCheck; i = 6; } Arrays.sort(lettersGuessed); } } } } } } } Hello, I'm trying to create a new link element using JS but using the following code: Code: writeCredits : function () { if (this.credits) return; this.credits = hs.createElement('a', { href: hs.creditsHref, target: hs.creditsTarget, className: 'highslide-credits', innerHTML: hs.lang.creditsText, title: hs.lang.creditsTitle }); this.createOverlay({ overlayId: this.credits, position: this.creditsPosition || 'top left', hsId: 'credits' }); }, It has the target but can I add anything to the createElement to make it open in a new window? Thanks for the help. This opens up in my current Hello everyone. I'm having a little problem with creating a element in internet explorer. The element that I'm creating is a div with a few style attributes to to it. The div is suppose to cover the whole page almost like a black transparent window on the page. However it is not. The messed up part about this is that it works fine in Firefox, google chrome and I'm sure other browsers (though haven't tested) and when I go to apply the div in my actual code as javascript is suppose to when you tell it create it, it works fine. No problems whatsoever... I'm not to sure what I'm doing wrong here and it would be great if I could get some help with this. Thanks Code: function showPhotoUpload() { var overlay = document.createElement("div"); overlay.setAttribute("style","z-index:3; background:#111111; width:100%; height:100%; position:absolute; top:0; opacity:0.5; filter:alpha(opacity:50);"); document.body.appendChild(overlay).lastChild; } I have a problem that I have been told to fix. The code that is there work perfectly in Firefox, but throws errors in IE and will not work. Code: var newtbody = document.createElement("tbody"); newtbody.id = "ROW"+newkey; document.getElementById(trElement).parentNode.insertBefore(newtbody,document.getElementById(trElement)); newtbody.innerHTML = gcp; gcp has the HTML for inside the tbody tag. The error I get in IE is the "Unknown runtime error". I have tried some of the "solutions" that I have seen online but none have worked. Can anyone help? Hi all, A few quick questions: Is there a difference between these two lines of code: var e = document.createElement('img'); -and- var e = new Image(); Both seem do do the same thing and act the same way... which makes me wonder why the second one even exists. There isn't a corresponding "new Div();" function, for example.... Second question: If I create an element to use temporarily and do not ever insert it into the DOM, do I need to delete or destroy it afterwards? Will it use memory (a memory leak) if I don't get rid of it after using? Thanks! -- Roger So i 've reviewed my work and can't see what i've done wrong. here is the html <code><html> <head> <title>Javascript Practic</title> <script type="text/javascript" src="Practice.js"> </script> </head> <body> write something here <div id="here"> blue here</div> </body> </html></code> and here is the javascript: <code> window.onload = tryInnerHTML; function tryAlert(){ alert("just trying it out"); } function tryInnerHTML(){ var p = document.createElement('p'); here = document.getElementById("here"); here.style.color = "blue"; p.innerHTML("<b>This is Dynamic</b>"); here.appendChild(p); } </code> firebug is saying the error is p.createElement('p'); but for the life of me I can't guess why any help would be very appreciative. Hi all, I am attempting to create an element (to be added later to the document DOM) using createElement. My test case is just: document.createElement("<p>Hello World</p>"); My error console shows the following error: Error: uncaught exception: [Exception... "String contains an invalid character" code: "5" nsresult: "0x80530005 (NS_ERROR_DOM_INVALID_CHARACTER_ERR)" location: "http://192.168.1.10/projects/test/public_html/js/test.js Line: 10"] Any ideas? Hello, If I have a <div id="mydiv"></div> and I use Code: iframe = document.createElement("iframe"); document.getElementById("mydiv").appendChild(iframe) Does the iframe append after </div> <iframe> or does it append <div id="mydiv"> <iframe> </div> Thanks hi, I am curious about the use of appendChild() here... I have a solution that does what I want it to do, like this: Code: var sidebarEntry = createSidebarEntry(poly, html); sidebar.appendChild(sidebarEntry); sidebar.replaceChild((sidebarEntry),sidebar.firstChild); but it seems to be going the long way around. Not that it matters much (I guess), but all I want to do is to add an item to the sidebar and when a new item is added, remove the existing one. I tried just using relaceChild() on its own, but the code seems to need something to be replace... Is the above the best way to do it? Or is it possible to set the child to some dummy position like null to begin with, so that the code is not constantly reloading and replacing items (which is what I understand is going on now)? here's the page I'm working on, if you want to see the rest of the code. I appreciate any thoughts. Need to append a hidden value to a floating div that is made via javascript. I tried the most obvious way but I am getting mismatch error in debug. .HTML Code: <input type="hidden" id="desc1" value="blah blah blah" /> .JS Code: var item; var image; var description; function one(){ item = document.getElementById("product1"); image = document.getElementById("i1"); description = document.getElementById("desc1"); expand(); } function expand() { //changes css of the div item.innerHTML = ""; item.style.position = "absolute"; item.style.top = "27%"; item.style.left = "21.3%"; item.style.width = "952px"; item.style.height = "610px"; item.appendChild(image); image.height = "300"; image.width = "400"; image.align = "left"; image.id = "cenimage"; ifrm = document.createElement("IFRAME"); ifrm.setAttribute("src", "form.html"); ifrm.setAttribute("frameborder", "0"); ifrm.setAttribute("scrolling", "no"); ifrm.style.width = 950+"px"; ifrm.style.height = 300+"px"; item.appendChild(ifrm); // mismatch error !! var x = description.value; item.appendChild(x); } I'm adding text into a text area using document.createTextNode Code: document.getElementById('controlQueueDump').appendChild(document.createTextNode(args+';')); But whenever the user edits the text box, it will never update anything again. I can add as much as I want, but when a user edits it (for example removes the contents), BAM, it is no longer updated. it's a textarea so it should be appending the child to the value attribute. Thanks a lot. I'm trying to check to see if a dynamically created element exists BEFORE creating another element of the same exact type...but my if statement at the beginning is not working and another element is just created. Code: function writeElement(id) { if(document.getElementsByTagName('transElement')[0]) { var id = id; killElement(); writeElement(id); } var id = id; var transElement = document.createElement('transElement'); var solidElement = document.createElement('solidElement'); var closeElement = document.createElement('closeElement'); //transElement.id = "transElement"; transElement.setAttribute('id', 'transElement'); solidElement.setAttribute('id', 'solidElement'); closeElement.setAttribute('id', 'closeElement'); closeElement.setAttribute('onClick', 'killElement()'); closeElement.innerHTML = "Close"; var content = "inject_poem.php?id=" + id; getdata(content, 'solidElement'); document.body.appendChild(transElement); document.body.appendChild(solidElement); document.body.appendChild(closeElement); } Does anyone know what is incorrect about my if statement? Dear Javascripters. I have some code that dynamicly adds textfields, the code works execpt for that I cant figure out how to place the textfield unded the textfield that calls on the function, it now places the new textfields at the bottom of the page.. Ive pasted my code on http://pastebin.com/m2fe9ba26 As soon as you focus in the TextField Productspecialisme: (max. 10) the javascript gets called on.. Thanks in advance. Regards Code: function displayResult() { var damn = document.getElementById("textyar").value; document.getElementById("oneforty").innerHTML = damn; var newDIV = document.createElement('div'); newDIV.className = "tweets"; var newspan =document.createElement('span'); newspan.className = "imagespanleft"; var img = document.createElement("IMG"); img.className="image"; img.src = "tweets/me.jpg"; newDIV.innerHTML = document.getElementById('textyar').value; document.getElementById('leftmaindiv').appendChild(newDIV).appendChild(newspan).appendChild(img); } this is the code , i m trying to create an interface like twitter where u put in text box and tweet appears below in problem is it is creating two divs instead of one , i tried insertbefore() as well but same behaviour plz ask any questions if u r still not clear I am making a web page, and as part of it I have a table that the user can add rows to. My code works in FF and Chrome, but IE is broken. Code: function addrow() { var example=document.getElementById("new"); var addHere=document.getElementById("ticketTable"); var node= example.cloneNode(true); node.id="added"; addHere.appendChild(node); } This code is called when a button is clicked. new is the ID of the row I am adding, and ticketTable is the ID of the table I am adding to. Help please! I'm not a JS programmer, I stumble around. I have a web page that uses: d = document.createElement("script"); d.type = "text/javascript"; d.src = "/var/www/html/UpDist.php"; return (document.body.appendChild(d)); <-- what I want to do UpDist.php returns a value that I need to continue and I can't get the above code to work - UpDist runs, the return value doesn't. Thanks Chuck Hey guys, First post i have searched the web a lot on this subject and am still confused so i thought id try and get some help from the experts, the following function works great in every browser except IE, the line of code that breaks in IE is highlighted in red. I have read some topics about this not working in IE and saw some workarounds with innerhtml or something but i don't really understand. Can someone please take some time to figure out a fix for this? Code: function displayStream(live_id) { var stream_out = document.getElementById("stream_out"); for (var j = 0; j < stream_out.childNodes.length; j++) { stream_out.removeChild(stream_out.childNodes[j]); } var object = document.createElement("object"); object.setAttribute("height", "475"); object.setAttribute("width", "998"); var param = document.createElement("param"); //param.setAttribute("name", "movie"); param.name = 'movie'; param.setAttribute("value", "http://www.own3d.tv/livestream/" + live_id); object.appendChild(param); var param = document.createElement("param"); param.setAttribute("name", "allowfullscreen"); param.setAttribute("value", "true"); object.appendChild(param); var param = document.createElement("param"); //param.setAttribute("name", "wmode"); param.name = 'wmode'; param.setAttribute("value", "transparent"); object.appendChild(param); var embed = document.createElement('embed'); embed.setAttribute("type", "application/x-shockwave-flash"); embed.setAttribute("src", "http://www.own3d.tv/livestream/" + live_id +";autoplay=true"); embed.setAttribute("allowfullscreen", "true"); embed.setAttribute("wmode", "transparent"); embed.setAttribute("height", "475"); embed.setAttribute("width", "998"); object.appendChild(embed); stream_out.appendChild(object); } Hi I discovered something weird that happend to me when trying to add a javascript created table to the document.body. Basically it doesn't add it in IE, but works fine in FF. Actually it does add it in IE, but only shows up if I add a <br/> later in a new statement... What?!?! try my code to see what is going on. (works fine in FF, does bad thing in IE) I tried to narrow the code i was working with down to basics and still have the glitch happen so maybe it's just something wrong with this code, but i couldn't pinpoint it. Also, it's only when i do document.body.appendChild(), not document.body.innerHTML += entireMassiveElement.innerHTML; I need it to work in both browsers with the appendChild() method, because innerHTML is much slower. Any advice appreciated! Thanks! 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> <title>Interace v1.0</title> <style type="text/css"> /****************** * --Panel Style ******************/ .panel { } .panel table td {padding: 0px;} .panel_corner { background-color: #00c0ff; background-repeat: no-repeat; width: 3px; height: 3px; } .panel_sideX {height: 3px; background-color: #00c0ff; background-repeat: repeat-x;} .panel_sideY {width: 3px; background-color: #00c0ff; background-repeat: repeat-y;} .panel_topLeft {background-position: 0px 0px;} .panel_topRight {background-position: -3px 0px;} .panel_bottomLeft {background-position: -0px -3px;} .panel_bottomRight {background-position: -3px -3px;} .panel_top {background-position: -3px -6px;} .panel_right {background-position: -3px 0px;} .panel_left {background-position: 0px 0px;} .panel_bottom {background-position: -3px -9px;} .panel_main { background-color: #00c0ff; } .panel_titlebar { color: #ffffff; font-family: verdana; font-size: 10pt; padding: 3px; padding-top: 0px; overflow: hidden; /* display: none; */ } .panel_title { float: left; height: 18px; overflow: hidden; } .panel_buttons { float: right; } .panel_toolbar { background-color: #444444; color: #eeeeee; font-family: verdana; font-size: 10pt; padding: 3px; overflow: hidden; display: none; } .panel_content { overflow: auto; font-family: arial; color: #eeeeee; font-size: 7pt; font-weight: bold; padding: 10px; border: 1px inset #cccccc; background-color: #444444; } </style> <!--///////////////////////////////////--> <script type="text/javascript"> function makeElement() { var layout = document.createElement("table"); //the table that is the basic layout var top = document.createElement("tr"); var tl = document.createElement("td"); top.appendChild(tl); var tc = document.createElement("td"); top.appendChild(tc); var tr = document.createElement("td"); top.appendChild(tr); var middle = document.createElement("tr"); var ml = document.createElement("td"); middle.appendChild(ml); var mc = document.createElement("td"); middle.appendChild(mc); var mr = document.createElement("td"); middle.appendChild(mr); var bottom = document.createElement("tr"); var bl = document.createElement("td"); bottom.appendChild(bl); var bc = document.createElement("td"); bottom.appendChild(bc); var br = document.createElement("td"); bottom.appendChild(br); layout.appendChild(top); layout.appendChild(middle); layout.appendChild(bottom); layout.style.borderCollapse = "collapse"; tl.className = "panel_corner panel_topLeft"; tc.className = "panel_sideX panel_top"; tr.className = "panel_corner panel_topRight"; tl.style.padding = "0px"; tc.style.padding = "0px"; tr.style.padding = "0px"; ml.className = "panel_sideY panel_left"; mc.className = ""; mr.className = "panel_sideY panel_right"; ml.style.padding = "0px"; mc.style.padding = "0px"; mr.style.padding = "0px"; bl.className = "panel_corner panel_bottomLeft"; bc.className = "panel_sideX panel_bottom"; br.className = "panel_corner panel_bottomRight"; bl.style.padding = "0px"; bc.style.padding = "0px"; br.style.padding = "0px"; //-- Set up the cursors for the bottom, right, and bottomright sides to resize mr.style.cursor = "e-resize"; bc.style.cursor = "s-resize"; // --Now create the internal structure, titlebar, toolbar, content area var main = document.createElement("div"); var titlebar = document.createElement("div"); var toolbar = document.createElement("div"); var content = document.createElement("div"); content.innerHTML = "success!"; main.appendChild(titlebar); main.appendChild(toolbar); main.appendChild(content); mc.appendChild(main); main.className = "panel_main"; titlebar.className = "panel_titlebar"; toolbar.className = "panel_toolbar"; content.className = "panel_content"; //-- create the titlebar internals, title, buttons, cleardiv var title = document.createElement("div"); var buttons = document.createElement("div"); var clear = document.createElement("div"); titlebar.appendChild(title); titlebar.appendChild(buttons); titlebar.appendChild(clear); clear.style.clear = "both"; title.className = "panel_title"; buttons.className = "panel_buttons"; main.style.width = "200px"; return layout; } function go(select) { var stuff = makeElement(); if(select == 1) { //-- Add everything to the container document.body.appendChild(stuff); } else if (select == 2) { //-- Add everything to the container //layout is a table, but innerHTML only returns the inner, so i just added on the outer tags. document.body.innerHTML += ('<table cellpadding="0" cellspacing="0">' + stuff.innerHTML + '</table>'); } //document.body.innerHTML += "<br/>"; } </script> </head> <body> <input type="button" value="test append Element" onclick="go(1);"/><input type="button" value="test innerHTML add" onclick="go(2);"/> <body> </html> I have: Windows server 2008 enterprise edition Apache 2.2.15 for windows Netbeans 6.7.1 Glassfish 2.1 Drupal 6.17 (that by default PostgreSQL 8.4 administrated through pgAdmin 1.10.0 (to store Netbeans elaborated data) Firefox and Chrome give me the same problem, tools used are even Httpfox and Fiddler2 Problem: I have a page where the user has to insert his own data, there are 2 types of data, Atributos and Datos. Atributos are on a atributos_user table in PostgreSQL and has 49 columns, Datos on datos_user, that has 119 columns. So when I clic on save, the js file on the page does: Code: function guardaTodo(){ var retvalue; retvalue = guardarMisDatos(); if(retvalue == false) { return retvalue; } retvalue = guardarAtributos(); } The function guardarAtributos works fine, so I guess that this one above is written correctly. The function guardarMisDatos is written the same way, and pretends to collect all the data through Netbeans. so whenever I click on the save button, i get in the web console this: The function guardarMisDatos does like this: Code: var param ="&usuario="+usuario+"&nivel="+nivel+gano+porc_gano+gasto+porc_gasto+tengo+porc_tengo+debo+ porc_debo+plazo_debo; var s = document.createElement("script"); s.type = "text/javascript"; s.async = true; s.src = server_direction +"setMisDatos?callback=respuestaGuardarMisDatos¶m="+encodeURIComponent(param); var h = document.getElementsByTagName("script")[0]; h.parentNode.insertBefore(s, h); //or h.appendChild(s); where every variable of the "param" is taken like this: Code: var plazo_debo_casa1 = (getValor("plazo_debo_casa1")); var plazo_debo_casa2 = (getValor("plazo_debo_casa2")); var plazo_debo_casa3 = (getValor("plazo_debo_casa3")); var plazo_debo_prestamo1 = (getValor("plazo_debo_prestamo1")); var plazo_debo_prestamo2 = (getValor("plazo_debo_prestamo2")); var plazo_debo_prestamo3 = (getValor("plazo_debo_prestamo3")); var plazo_debo ="&plazo_debo_casa1="+plazo_debo_casa1+"&plazo_debo_casa2="+plazo_debo_casa2+"&plazo_debo_casa3="+plazo_debo_casa3+"&plazo_debo_prestamo1="+plazo_debo_prestamo1+"&plazo_debo_prestamo2="+plazo_debo_prestamo2+"&plazo_debo_prestamo3="+plazo_debo_prestamo3; so anytime I call the function, i mean, i click on save, the browser fires: Code: http://www.mirodinero.com:8080/mirodinero-war/setMisDatos?callback=respuestaGuardarMisDatos¶m=%26usuario%3DIsa%20Mirodinero%26nivel%3D109%26gano_sal_neto%3D211113.45%26gano_sal_prof%3D234480%26gano_monet%3D0%26gano_renta_fija%3D0%26gano_renta_vble%3D0%26gano_inmuebles%3D6750%26gano_otros%3D23730%26gano_otros_ing%3D411125%26porc_gano_monet%3D0%26porc_gano_rentaf%3D0%26porc_gano_rentav%3D0%26porc_gano_inm%3D2%26porc_gano_otros%3D2%26porc_gano_otros_ing%3D1%26gasto_casa1%3D1306.46%26gasto_casa2%3D2402.38%26gasto_casa3%3D3999.57%26gasto_prestamo1%3D93475.58%26gasto_prestamo2%3D7325.88%26gasto_prestamo3%3D34090.9%26gasto_tarjetas%3D29443.2%26gasto_ibi%3D5670%26gasto_imp_otros%3D6780%26gasto_seg_inm%3D1320%26gasto_seg_pens%3D3451.22%26gasto_seg_vida%3D330%26gasto_seg_plan%3D34230%26gasto_seg_medico%3D1220%26gasto_seg_coche%3D20%26gasto_luz%3D620%26gasto_agua%3D4550%26gasto_gas%3D320%26gasto_telef_f%3D320%26gasto_telef_m%3D350%26gasto_internet%3D20%26gasto_tv%3D3450%26gasto_hogar%3D20%26gasto_comida%3D20%26gasto_cenas_copas%3D20%26gasto_viajes%3D20%26gasto_vacaciones%3D220%26gasto_mobiliario%3D220%26gasto_ropa%3D2320%26gasto_transp%3D20%26gasto_otros%3D620%26gasto_colegios%3D240%26gasto_univ%3D340%26gasto_master%3D2230%26gasto_otros_gastos%3D73433%26porc_gasto_tarjetas%3D0%26porc_gasto_ibi%3D0%26porc_gasto_trib%3D0%26porc_gasto_seg_inm%3D0%26porc_gasto_seg_pens%3D0%26porc_gasto_seg_vida%3D2%26porc_gasto_seg_plan%3D2%26porc_gasto_seg_med%3D0%26porc_gasto_seg_coche%3D0%26porc_gasto_sum_luz%3D2%26porc_gasto_sum_agua%3D2%26porc_gasto_sum_gas%3D0%26porc_gasto_sum_teleff%3D0%26porc_gasto_sum_telefm%3D0%26porc_gasto_sum_int%3D0%26porc_gasto_sum_tv%3D0%26porc_gasto_nivel_hogar%3D0%26porc_gasto_nivel_comida%3D0%26porc_gasto_nivel_cenas%3D0%26porc_gasto_nivel_viajes%3D0%26porc_gasto_nivel_vacac%3D0%26porc_gasto_nivel_mob%3D0%26porc_gasto_nivel_ropa%3D0%26porc_gasto_nivel_transp%3D0%26porc_gasto_nivel_otros%3D0%26porc_gasto_colegios%3D2%26porc_gasto_univ%3D0%26porc_gasto_master%3D0%26porc_gasto_otros_gastos%3D23%26tengo_casa1%3D1231.11%26tengo_casa2%3D10000%26tengo_casa3%3D22240%26tengo_otras%3D23560%26tengo_monetario%3D1212.34%26tengo_planpensiones%3D23230%26tengo_otros%3D23330%26porc_tengo_casa1%3D1%26porc_tengo_casa2%3D0%26porc_tengo_casa3%3D2%26porc_tengo_otras%3D0%26porc_tengo_monet%3D0%26porc_tengo_plan%3D0%26porc_tengo_otros%3D0%26debo_casa1%3D4340%26debo_casa2%3D23450%26debo_casa3%3D23430%26debo_prestamo1%3D23330%26debo_prestamo2%3D6871.11%26debo_prestamo3%3D11340%26debo_tarjetas%3D61340%26porc_debo_casa1%3D30%26porc_debo_casa2%3D10%26porc_debo_casa3%3D12%26porc_debo_prestamo1%3D1%26porc_debo_prestamo2%3D12%26porc_debo_prestamo3%3D1%26porc_debo_tarjetas%3D4%26plazo_debo_casa1%3D230%26plazo_debo_casa2%3D450%26plazo_debo_casa3%3D122%26plazo_debo_prestamo1%3D3%26plazo_debo_prestamo2%3D12%26plazo_debo_prestamo3%3D4 and doesn't work on the first click, or after 30 seconds idle, like browsing another tab, etc. Tried Solutions: Tried changing h.appendChild(s) to parentNode.insertBefore(s, h) -> works better but not enough Change the order of guardaTodo exchanging the 2 functions -> guardarMisDatos never works Included httpd-default.conf to the httpd.conf file, setting this parameters: Timeout: The number of seconds before receives and sends time out. Timeout 30000 KeepAlive: Whether or not to allow persistent connections (more than one request per connection). Set to "Off" to deactivate. KeepAlive On MaxKeepAliveRequests: The maximum number of requests to allow during a persistent connection. Set to 0 to allow an unlimited amount. We recommend you leave this number high, for maximum performance. MaxKeepAliveRequests 0 KeepAliveTimeout: Number of seconds to wait for the next request from the same client on the same connection. KeepAliveTimeout 500 Divide the guardarMisDatos function into more pieces, like saving only part of the Datos -> it works fine on that columns that i'm saving, but deletes all remaining columns What I'm searching for: I have been searching what kind of setting I should change in Apache httpd.conf to enable a connection that doesn't timeout and opens on the right time. My Apache httpd.conf is of the kind that includes other httpd-*.conf files. Findings: From httpfox i get NS_ERROR_NET_RESET, that occurs on the first click to the "save" button, or after a while that i don't view that page. I counted how much time shall I stay idle to "lose" the connection (and get the same error), it's more or less 30 seconds. So I even checked with fiddler2, and get this kind of message: "ReadResponse() failed: The server did not return a response for this request." Observation (Similar case): I've found this question to have a problem similar to mine, but I already talked with my hosting service and they told me that there is no firewall preventing connections. Solution: I don't have a solution, it's been weeks now, and probably nobody helped me because the stuation was not well explained, that's why now i wrote it down with more details as possible. I hope that now this is well explained and to get some help. |