vado subito al sodo, ho uno javascript che recupera i dati da un form generato da php ( qui di seguito il codice) ma non riesco a POSTARLO ! sto diventando matto , non capisco come mai il parsin dei dati non avvenga.
il codice javascript è riciclato dato che il mio non funzava ho pensato fossero dei problemi sui cicli di retrieve dei campi dal form ( funzione getAnteprima() ) ma pare proprio di no
un aiutino a togliermi il prosciutto dagli occhi
javascript
formcodice:<script type="text/javascript" language="javascript"> var http_request = false; function makeRequestAnteprima(url, parameters) { http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { // set type accordingly to anticipated content type http_request.overrideMimeType('text/xml'); http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContentsAnteprima; http_request.open('GET', url + parameters, true); http_request.send(null); } function alertContentsAnteprima() { if (http_request.readyState == 4) { if (http_request.status == 200) { alert(http_request.responseText); result = http_request.responseText; document.getElementById('myspan').innerHTML = result; } else { alert('There was a problem with the request.'); } } } function getAnteprima(obj) { var getstr = "?"; for (i=0; i<obj.childNodes.length; i++) { if (obj.childNodes[i].tagName == "INPUT") { alert('input'); if (obj.childNodes[i].type == "text") { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } if (obj.childNodes[i].type == "checkbox") { if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } else { getstr += obj.childNodes[i].name + "=&"; } } if (obj.childNodes[i].type == "radio") { if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } } } if (obj.childNodes[i].tagName == "SELECT") { var sel = obj.childNodes[i]; getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&"; } } makeRequestAnteprima('azioni/anteprima.php', getstr); } </script>
Graaaaziecodice:<form action="javascript:getAnteprima(document.getElementById('anteprima'));" name="anteprima" id="anteprima"> <table border="0" width="100%"> <tbody><tr> <td> <table border="1"><tbody><tr><td rowspan="2" valign="top">Quantita ordine:</td> <td align="right" width="50">0</td> <td>Pezzi.</td></tr> </tbody></table> </td> <td> <table border="1"> <tbody><tr> <td>COLORE</td> <td>AZZU</td> <td>GIAL</td> <td>NATU</td> <td>BLU1</td> <td>ROYA</td> <td>BIAN</td> <td>SENA</td> </tr> <tr> <td>50X80</td> <td><input class="CampoPink" name="a200000303032AZ" value="" maxlength="3" type="text"></td> <td><input class="CampoPink" name="a200000303032GI" value="" maxlength="3" type="text"></td> <td><input class="CampoPink" name="a200000303032NA" value="" maxlength="3" type="text"></td> <td><input class="CampoPink" name="a200000303032B1" value="" maxlength="3" type="text"></td> <td><input class="CampoPink" name="a200000303032RY" value="" maxlength="3" type="text"></td> <td><input class="CampoPink" name="a200000303032BI" value="" maxlength="3" type="text"></td> <td><input class="CampoPink" name="a200000303032SE" value="" maxlength="3" type="text"></td> </tr> </tbody></table> </td> </tr> <tr> <td colspan="2" align="center" bgcolor="grey"> <input name="button" value="Normal Submit Button" type="submit"> <input name="button" value="Submit" onclick="javascript:getAnteprima(this.parentNode);" type="button"> </td> </tr> </tbody></table> </form>
![]()


Rispondi quotando
aiuttoooo :|
