andrisp Posted November 22, 2005 Report Share Posted November 22, 2005 ir js: <script type="text/javascript"> function qup(img) { var x = document.getElementById(img); if (x.value >= 1) { x.value = x.value + 1; } else { x.value = 1; } return false; } </script> kas droshi vien ir nepareizs un ir html: <input id="IMG_0982.jpg" name="images[IMG_0982.jpg]" type="text" value="1" size="1" /> <a href="#" onclick="return qup('IMG_0982.jpg'); return false; ">1up</a> kursh droshi vien ir taads pats :) kopaa tas viss atgriezh Error: x has no properties kur man ir kljuudas? paldies Link to comment Share on other sites More sharing options...
v3rb0 Posted November 22, 2005 Report Share Posted November 22, 2005 (edited) tur kaut kas cits.. jo pliks piemērs strāda uz visiem 3browseriem - http://paste.php.lv/2890 Edited November 22, 2005 by v3rb0 Link to comment Share on other sites More sharing options...
bubu Posted November 22, 2005 Report Share Posted November 22, 2005 (edited) Un ja šādi: <script type="text/javascript"> function qup(img) { var x = document.getElementById(img); if (x) { if (x.value >= 1) { x.value = x.value + 1; } else { x.value = 1; } } else { alert("nav atrasts ID="+img); } return false; } </script> Kas tad notiek? Edit: btw - onclick="return qup('IMG_0982.jpg'); return false; " Tev tur divi return.. a izpildās tikai pirmais, tb no otrā return nav nekādas jēgas. Edited November 22, 2005 by bubu Link to comment Share on other sites More sharing options...
andrisp Posted November 22, 2005 Author Report Share Posted November 22, 2005 atradu probleemu un probleema tieshi bija taapeec, ka vienkaarshi tika padots nepareizs ID: <input id="IMG+++0982.jpg" name="images[IMG+++0982.jpg]" type="text" value="1" size="1" /> <a href="#" onclick="return qup('IMG 0982.jpg'); return false; ">1up</a> kaa jau var noprast - visur, iznjemot ieksh onclick, tika izmantots urlencode, taapeec arii negaaja. ps. paldies v3rb0 par: x.value = (x.value * 1) + 1; ps2. vispaar probleemas nevareetu rasties, ja izmanto taadus simbolus kaa atstarpe, +, -, peedinjas utt ieksh id un name atribuutiem ? uztraucos, jo nekad jau nevar zinaat, ar kaadu faila nosaukumu lietotaajs uploadees atteelu.. Link to comment Share on other sites More sharing options...
bubu Posted November 22, 2005 Report Share Posted November 22, 2005 Dokumentāciju, protams, nelasam :) http://www.w3.org/TR/html401/types.html#type-name # ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). Link to comment Share on other sites More sharing options...
andrisp Posted November 22, 2005 Author Report Share Posted November 22, 2005 hmm baigi beediigi izskataas, tad sanaak, ka urlencode labaak neizmantot, bet atstarpes arii nelegaalas. ko lai dara ? :/ iedomaajos, vareetu uztaisit pats savu funkciju, kas speisus un citus 'nelegaaljus':) paarkonvertee par kautko legaalu, bet arii tas 100% gljukos :/ Link to comment Share on other sites More sharing options...
v3rb0 Posted November 22, 2005 Report Share Posted November 22, 2005 usera uplodētos failus vislabāk nosaukt pa savam ar 'pareiziem' vārdiem, ja vajag orģinālo vārdu pieglabā kaut kur, db vai blakus plain txt failā. Link to comment Share on other sites More sharing options...
andrisp Posted November 22, 2005 Author Report Share Posted November 22, 2005 (edited) man taada stulba situaacija, ka klientam (tam kam taisu sho softu), vajag lai uploadeetie faili buutu ar origjinaalnosaukumiem.. Edit: Veel viena diivaina lieta (imho), tas ka ja ir iesetots magic_quotas = on, tad vinjs(php) baazh slashus klaat pat uploadeeto failu nosaukumiem.. Edited November 22, 2005 by andrisp Link to comment Share on other sites More sharing options...
v3rb0 Posted November 22, 2005 Report Share Posted November 22, 2005 tad varbūt pamēģini vai onclick="return qup(this); un function qup(x) { .. ar nestrādā ar aplamiem id? Link to comment Share on other sites More sharing options...
Recommended Posts