Ce trebuie sa mai adaug?
Last Updated: Feb 28 2016 12:09, Started by
dhaneey
, Feb 27 2016 23:43
·
0
#1
Posted 27 February 2016 - 23:43
Se da urmatorul script:
<!DOCTYPE html> <html> <body> <script type="text/javascript"> function dosearch() { var sf=document.searchform; for (i=sf.sengines.length-1; i > -1; i--) { if (sf.sengines[i].checked) { var submitto = sf.sengines[i].value + escape(sf.searchterms.value); } } window.open(submitto); return false; } </script> <form name="searchform" onsubmit="return dosearch();"> Search:<br /> <input name="sengines" type="checkbox" value="http://www.google.ro....ro/search?q="> Google<br /> <input name="sengines" type="checkbox" value="https://ro.search.ya....com/search?p=")> Yahoo<br /> <input name="sengines" type="checkbox" value="http://www.bing.com/...orm=QBLH&pq=/"> Bing<br /> <input name="sengines" type="checkbox" value="http://www.imdb.com/..._=nv_sr_fn&q="> Imdb<br /> For: <input type="text" name="searchterms"> <input type="submit" name="SearchSubmit" value="Search"> </form> </body> </html> Eu vreau sa bifez cate checkbox-uri am chef si sa-mi deschida in alte taburi rezultatele cautarii. Are cineva idee cum as putea face asta? Edited by dhaneey, 27 February 2016 - 23:44. |
#2
Posted 28 February 2016 - 04:25
Mi-am permis să folosesc jquery:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#form [type=submit]').click(function(){ $('#form [type=checkbox]').each(function(){ if($(this).is(':checked')) { window.open($(this).val() + $('#form [type=text]').val()); } }) }) }) </script> </head> <body> <div id="form"> Search:<br /> <input name="sengines" type="checkbox" value="http://www.google.ro/search?q=" /> Google<br /> <input name="sengines" type="checkbox" value="http://ro.search.yahoo.com/search?p=" /> Yahoo<br /> <input name="sengines" type="checkbox" value="http://www.bing.com/search?q=" /> Bing<br /> <input name="sengines" type="checkbox" value="http://www.imdb.com/find?q=" /> Imdb<br /> For: <input type="text" name="searchterms"> <input type="submit" name="SearchSubmit" value="Search"> </div> </body> </html> |
#3
Posted 28 February 2016 - 10:32
mersi, dar din pacate nu face ce vreau eu, nu deschide mai multe taburi...
mai are cineva vreo idee? |
#4
Posted 28 February 2016 - 10:53
Unde ai testat ?
Ai tot codul ? Ai bifat căsuţele ? Merge foarte bine. Asta face window.open, îţi deschide taburi noi. |
#5
Posted 28 February 2016 - 11:28
am testat pe ie, chrome si mozilla, deschide doar un tab indiferent cate casute as bifa.
Eu as vrea sa deschida 3 tab-uri (in acelasi timp) daca bifez 3 casute, 5 taburi (in acelasi timp) daca bifez 5 casute etc. Dar mie imi deschide doar una indiferent cate as bifa. Practic e ca si cum as avea radio in loc de checkbox. Ideea e sa fac economie la numarul de click-uri Edited by dhaneey, 28 February 2016 - 11:30. |
Anunturi
Bun venit pe Forumul Softpedia!
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users