03-18-2004, 09:25 AM
when I call some of my functions in JS, they work with no problems.... but then it seems to crash the entire browser when I try to do something else.
Is there a cache or is it possible that some JS variables are being remembered??
I was just wondering if there was a way to clear the cache maybe?? Its really confusing me why its doing this!!
03-18-2004, 09:50 AM
What was that "something else" that you did and caused the browser to crash?
03-18-2004, 10:23 AM
well, there is a lot of things happening... but it seems to be when I call a function to check if text is highlighted.. I then say, listen to what key was pressed...
if the user tries to delete the selection, it does the following
alert("you cant delete that");
iView.event.cancelBubble = true;
iView.event.returnValue = false;
it then crashes if you try to type or do anything else....
is there a buffer or something?
03-18-2004, 10:33 AM
Probably best if I give you an example!!
highlight the first three lines (from Dear.... to .... is)
then press the backspace key....
it will alert saying you cant delete that...
then put your cursor infront of the first word "Dear"
and press any key..
it then crashes......
03-18-2004, 10:48 AM
I found the problem - just need help to solve it now!!
here's the function causing problems...
var code = iView.document.selection;
var tmp = code.createRange();
//we cannot move left as there are no characters there! (possible the beginning of the page)
the code is supposed to get the character to the left of the cursor position... but if there is no character to the left -ie the cursor is at the beginning of the sentance, then it should return a value of "" (blank)... otherwise return a value of the character.
I need a way of saying - if moving one char back is not possible, then return ""....
but it doesnt work!!