Autor | Zpráva | ||
---|---|---|---|
Šéva Profil |
#1 · Zasláno: 27. 2. 2013, 12:26:03
Zdravím,
našel jsem si script, který umí vyhledávat text v textaree www.tek-tips.com/faqs.cfm?fid=6479 Ale má to háček, funguje to jen pod IE a já potřebuju, aby to fungovalo pod Firefoxem. Zkoušel jsem to i nějak ohnout, aby to chodilo pod FF,ale bez úspěchu.Vyhledávání přes ctrl+f není v tomto případě, ktery potřebuju dostačující, protože mám ve stránce nekolik iframe a chci vyhledávat pouze v tom jednom iframe, ve kterém zrovna uživatel je. Díky za rady |
||
pako Profil * |
#2 · Zasláno: 1. 3. 2013, 08:39:27
Šéva:
nie je uplne jasne co vlastne chces dosiahnut. dalo by sa skor povedat ze absolutne nechapem, ale sposob, ktorym to co potrebujes dosiahnut robi IE, robia ostatne prehliadace (pravdepodobne) metodami popisanymi tu: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html - mozes si to skusit ohnut. pripadne existuje mala kniznica, ktorej metody by ti mohli pomoct http://code.google.com/p/rangyinputs/ na jej prevadzku ale budes potrebovat jQuery |
||
Šéva Profil |
#3 · Zasláno: 1. 3. 2013, 12:59:17
<html> <head> <script type="text/javascript"> var theRange = null; window.onload = function() { try { theRange = document.getElementById('myText').createTextRange(); } catch(e) {} if (theRange == null) { alert('There was an error creating a textRange. Perhaps your browser doesn\'t support them.'); } } function findNext() { if (theRange != null) { theRange.findText(document.getElementById("hledany_vyraz").value); theRange.select(); var charsMoved = theRange.moveStart('character', 3); if (charsMoved == 0) { var startAgain = window.confirm('No more matches found. Start again from the beginning?'); if (startAgain) { theRange.moveStart('textedit', -1); findNext(); } } } } </script> </head> <body> <form> Hledaný výraz<br /> <input type="text" id="hledany_vyraz"><br /> <textarea id="myText" cols="40" rows="5">Here is some text [ ], and here is some more [ ], and yet even more text! [ ]</textarea> <br /> <input type="button" onclick="findNext();" value="Find next" /> </form> </body> </html> |
||
Časová prodleva: 11 let
|
0