p4F Posted June 13, 2008 Report Share Posted June 13, 2008 Nevaru saprast kapēc refrešojas lapa uspiežot uz Submit: <INPUT TYPE=submit VALUE=Submit onClick="my_submit();return false;"> Viss ko"ds: http://paste.php.lv/7529?lang=php Link to comment Share on other sites More sharing options...
codez Posted June 14, 2008 Report Share Posted June 14, 2008 (edited) pie TYPE un VALUE "submit" ieliec pēdiņās. Edited June 14, 2008 by codez Link to comment Share on other sites More sharing options...
Grey_Wolf Posted June 14, 2008 Report Share Posted June 14, 2008 type="submit" vietaa vari izmantot type="button" + parbaudi jaliek nevis pie Submit oogas bet gan pie Fomas <form .... OnSubmit="bla()" ..... Link to comment Share on other sites More sharing options...
andrisp Posted June 14, 2008 Report Share Posted June 14, 2008 Iespējams, ka my_submit() atgriež true. Kaut gan tas laikam šajā gadijumā neko nemainītu. Liec to kodu pie formas onsubmit. Link to comment Share on other sites More sharing options...
Mr.Key Posted June 14, 2008 Report Share Posted June 14, 2008 Tieši tā arī ir - forma nesubmitotos, ja "return false" būtu formas onSubmit notikumā. Šeit "return false" ir pogas onClick notikumā, kurš parasti izsauc formas submitošanu, bet man liekas, ka tas baigi atkarīgs no browsera, kādā secībā tie eventi izpildās. Grey_Wolf - vispārīgi ņemot, ja ar pogu ir paredzēts submitot formu, tad pogai jābūt kā submit tipa pogai, nevis buttonam vai linkam ar javascriptu. Link to comment Share on other sites More sharing options...
p4F Posted June 15, 2008 Author Report Share Posted June 15, 2008 vai var piem kautkā onsubmit="ja uzspieda uz submit ar name='cits' tad refreshojas, ja uzspieda uz submit ar name='parasts' nerefreshojas" Link to comment Share on other sites More sharing options...
Mr.Key Posted June 15, 2008 Report Share Posted June 15, 2008 (edited) nu variants ir, kā jau te norādīja - pirmo taisi kā type='submit', otro kā type='button' otrs nupat prātā ienācis variants - pogas onClick eventā - "this.form.refreshoMani = true;" vai "this.form.refreshoMani = false;" un tad attiecīgi formas onsubmit eventā skatās to vērtību. Laikam klāt vēl viens hidden lauks. Edited June 15, 2008 by Mr.Key Link to comment Share on other sites More sharing options...
p4F Posted June 15, 2008 Author Report Share Posted June 15, 2008 function add_d(){ var type = document.getElementById('domain_type'); var name = document.getElementById('domain_new_name'); var zone = document.getElementById('domain_new_ext'); var time = document.getElementById('years'); if(name.length() > 0 && zone.length() > 0) { var url = 'cd.php?domain'+name+'&zone='+zone; new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { var notice = $('one'); if (transport.responseText == 'yes') notice.update('tāds domain ir').setStyle({ background: '#dfd' }); else notice.update('tāda domaina nav').setStyle({ background: '#fdd' }); } }); }else{ alert("Не правильный запрос."); } } kas nepareizs šeit? tas ir prototype Link to comment Share on other sites More sharing options...
p4F Posted June 15, 2008 Author Report Share Posted June 15, 2008 viss es sapratu function add_d(){ var type = document.register_MEGAHOST.domain_type.value; var name = document.getElementById('domain_new_name').value; var zone = document.register_MEGAHOST.domain_new_ext.value; var time = document.register_MEGAHOST.years.value; if(name.length > 0 && zone.length > 0) { var url = 'cd.php?domain='+name+'&zone='+zone; //alert("1"+url); new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { var notice = $('one'); if (transport.responseText == 'yes') notice.update('tāds domain ir').setStyle({ background: '#dfd' }); else notice.update('tāda domaina nav').setStyle({ background: '#fdd' }); } }); }else{ alert("Не правильный запрос."); } } tagad man ir jauns jautājums ar kādu funkcija uz php būtu explode bet kā būtu ar JS? Link to comment Share on other sites More sharing options...
bubu Posted June 15, 2008 Report Share Posted June 15, 2008 "a--d--f".split("--"); Link to comment Share on other sites More sharing options...
p4F Posted June 15, 2008 Author Report Share Posted June 15, 2008 (edited) bet kā piem lai ieliktu to array? iekš php būtu $teksts = 'sa--da'; $ex = explode($teksts, '--'); echo $ex[1]; bet Js? Edit: atradu tāpat un būs :) Edited June 15, 2008 by p4F Link to comment Share on other sites More sharing options...
bubu Posted June 15, 2008 Report Share Posted June 15, 2008 es tak to arī parādīju, ko prasi. var teksts = "a--d--f"; var ex = teksts.split("--"); alert(ex[1]); Link to comment Share on other sites More sharing options...
Recommended Posts