 |
|
 |
This is not working in IE.
Thanks,
Janaka
Novice to programming
|
|
|
|
 |
|
 |
Hi , this is one of my versions with listbox:-
this program highlights the word starting with the strings typed in the textbox as soon as the key is pressed....agian when the backspace key is used to delete a character frm the given string in the textbox, the program highlights the word starting with the remaining string in the textbox
<script type="text/javascript">
function ascii_press2 ()
{var charp = String.fromCharCode(key_k);
var pre = this.document.getElementById ("txt1").value;
if(window.event.keyCode == 8)
{var re = new RegExp("^" + pre, "i");
var num = this.document.getElementById ("lb1").length;
for(var i=0; i
in the pageload
txt1.Attributes.Add("onKeyUp", "javascript:ascii_press2();")
txt1.Attributes.Add("onKeyPress", "javascript:ascii_press();")
txt1 is the textbox and lb1 is the listbox......it works well in the IE...
now i want this for netscape..........can any give me a little idea from where to begin?
|
|
|
|
 |
|
 |
function [A,C]=SSA(file_name,m,bShow)
X=csvread(file_name);
X=diff(X);
B=Embed(X,m);
C=cov(B);
[V,D]=eig(C);
%A=D;
%A=sum(A');
[mm,nn]=size(X);
A=zeros(mm-m+1,m);
for i=0:mm-m
for k=1:m
A(i+1,k)=SSA_a(i,k,m,X,V);
end
end
if(bShow==1)
lim=200;
for(ll=1:m)
figure(ll),plot(A(1:lim,ll));
end
end
dlmwrite('e:/V.csv',V,';');
dlmwrite('e:/D.csv',D,';');
end
function a=SSA_a(i,k,m,X,V)
a=0;
for j=1:m
a=a+V(j,k)*X(i+j);
end
end
function XEmbedded=Embed(X,m)
[mm,nn]=size(X);
XEmbedded=zeros(mm-m+1,m);
for i= 1:mm-m+1
XEmbedded(i, = X(i:i+m-1)';
end
end
|
|
|
|
 |
|
 |
I'll apply my site now.. thx~
|
|
|
|
 |
|
 |
Does any of you know how to create a drop-down list that allows the user to search for a word in the list using two characters which will be match to the first two characters of the words in the list.
For instance, we are use to searching in a drop-down list using one character which match to the first letter of the words in the list in alphabetic order.
Now, what I am looking for is to search with two characters; which will match with the first two letters of the words in the list in alphabetic order.
|
|
|
|
 |
|
 |
I made a semi-workable solution. If you would like the code, you can contact me in the mozillazine thread.
|
|
|
|
 |
|
 |
Nice work. Does anyone know how to test if a select tag is expanded or collapsed? Or how to force a select tag to expand from javascript?
|
|
|
|
 |
|
 |
Have this code in the body of your document. This should work for all types of controls - textbox, combos, etc (right click to expand a control). You can change it to check the type to work only for combos if you want:
if(event.button == 2 )
{
var element = event.srcElement;
if(element.oldWidth == undefined || element.oldWidth == "")
{
element.oldWidth = element.style.width;
element.style.width = "";
}
else
{
element.style.width = element.oldWidth;
element.oldWidth = "";
}
}
-- modified at 9:02 Sunday 12th March, 2006
|
|
|
|
 |
|
 |
Actually i used the code given by PiedPiper6971.But one think i noticed that if you type after opening the list once you write and find the required string and just click the tab key.The content is getting change.It's working fine without opening the list.Can anybudy mark this or give me solution for this.
Anup
|
|
|
|
 |
|
 |
Congratulations... very good job.
|
|
|
|
 |
|
 |
hey ths is an nice trick an idea
|
|
|
|
 |
|
 |
Can anyone tell me what the keycode would be for backspace if I wanted to use it? Thanks!
Sue
|
|
|
|
 |
|
 |
Why backspace, use this code for any keycode
<HTML>
<HEAD>
<script language='JavaScript'>
function showMeKeyCode()
{
alert(event.keyCode);
return true;
}
</script>
</HEAD>
<BODY>
<input type=text name='Test' value='' önKeyDown='return showMeKeyCode()' />
</BODY>
</HTML>
|
|
|
|
 |
|
 |
After adding all the other event handler, my onChange event handler is not being called.
Does anyone know why ?
Thanks
|
|
|
|
 |
|
 |
Hi
the onChange event fired is after onkeyPress event
since we are handling onkeyPress event and the code window.event.returnValue = false;will prevent the default behaviour hence onChange event is not fired.
The onChange event must be triggered explicily .
please refere the code below this will trigger onChange event also
regards
prashanth
prashanth.nagaraja@thomson.com
function selectKeyPress()
{
// Notes:
// 1) previous keys are cleared onBlur/onFocus and with Delete key
// 2) if the search doesn't find a match, this returns to normal 1 key search
// setting returnValue = false below for ALL cases will prevent
// default behavior
//TODO:
// 1) add Netscape handling
var sndr = window.event.srcElement;
var pre = this.document.all["keys"].value;
var key = window.event.keyCode;
var char = String.fromCharCode(key);
var re = new RegExp("^" + pre + char, "i"); // "i" -> ignoreCase
for(var i=0; i |
|
|
|
 |
|
 |
Just what I was looking for, to make it a little more useful I removed the "^" to search the whole string rather than having to type everything up to the word you're looking for.
|
|
|
|
 |
|
 |
<html> <head> <script type="text/javascript"> /* The SMK_KeyPress function (SMK = Select Match Keystrokes) provides keystroke matching for SELECT controls. The SELECT element declaration should direct the onkeypress event to this function, and declare two expandos: smk_keystrokes and smk_lastpresstime. */ function SMK_KeyPress() { var sndr = window.event.srcElement; var key = window.event.keyCode; var char = String.fromCharCode(key); var sysdate = new Date(); // if the last key press was more than 2 seconds ago, reset the keystrokes if(sndr.smk_lastpresstime=="" || sysdate.getTime()-sndr.smk_lastpresstime>2000) { sndr.smk_keystrokes = ""; } sndr.smk_lastpresstime = sysdate.getTime(); // set up a regular expression for comparing with list box entries var re = new RegExp("^" + sndr.smk_keystrokes + char, "i"); // "i" -> ignoreCase // check each list box item for a match for(var i=0; i<sndr.options.length; i++) { if(re.test(sndr.options[i].text)) { sndr.options[i].selected=true; sndr.smk_keystrokes += char; break; } } // sink the keypress, ie don't pass it on to Windows or anything else window.event.returnValue = false; } </script> </head> <body> <select smk_keystrokes="" smk_lastpresstime="" onkeypress="SMK_KeyPress();"> <option>Argentina</option> <option>Australia</option> <option>Austria</option> <option>Belarus</option> <option>Belgium</option> <option>New Guinea</option> <option>New Zealand</option> <option>United Arab Emirates</option> <option>United States</option> </select> <br/><br/> <select smk_keystrokes="" smk_lastpresstime="" onkeypress="SMK_KeyPress();"> <option>Argentina</option> <option>Australia</option> <option>Austria</option> <option>Belarus</option> <option>Belgium</option> <option>New Guinea</option> <option>New Zealand</option> <option>United Arab Emirates</option> <option>United States</option> </select> </body> </html>
|
|
|
|
 |
|
 |
Nice work here.
I was looking at this page from Mozilla 1.5 and thinking, that's weird.. the non-searching select works the same way as the autosearching select. That's when I realized.. Moz 1.5 has this capability built-in. It wasn't until I switched back to IE6 that I saw the difference.
So.. maybe you should call this function "autosearching selects for antiquated IE browsers" .
-dave
|
|
|
|
 |
|
 |
Actually i used the code given by you.But one think i noticed that if you type after opening the list once you write and find the required string and just click the tab key.The content is getting change.It's working fine without opening the list.Can anybudy mark this or give me solution for this.
Anup
|
|
|
|
 |
|
 |
Actually i used the code given by you.But one think i noticed that if you type after opening the list once you write and find the required string and just click the tab key.The content is getting change.It's working fine without opening the list.Can anybudy mark this or give me solution for this.
Anup Agrawal
|
|
|
|
 |
|
 |
Fantastic.
The only mod I have made it check for the user hitting backspace
if(sndr.smk_lastpresstime=="" || sysdate.getTime()-sndr.smk_lastpresstime>2000 || key==8) {
sndr.smk_keystrokes = "";
}
Just makes it a bit easier for the hamfisted user.
|
|
|
|
 |
|
 |
I like this a lot. I'm using it on a very long selection list, and it helps my users. However, I have to point out that using a hidden field to store the keystrokes isn't strictly necessary. You can just as easily declare pre as a variable outside the functions so that it retains its value between function calls. That lets you eliminate the document.all calls that make this incompatible with Netscape/Mozilla.
|
|
|
|
 |
|
 |
silentdoug, can you share the modifcation you made to make this work in Netscape?
|
|
|
|
 |
|
|
 |
|
 |
Very nice. hehe the <select> tag messed up the front page for a few minutes. LOL
$TeVe McLeNiThAn
|
|
|
|
 |