dcole.ath.cx Posted April 24, 2006 Share Posted April 24, 2006 I have a filemanager and I want to make it easier to find the line an error is on.Is there a way to have JS goto a line in a textarea. or what would be the best way for someone to input the line they want to go to and have then sent there? Link to comment Share on other sites More sharing options...
aspnetguy Posted April 24, 2006 Share Posted April 24, 2006 I don't think there is, even if there was goto is not an effiecient way of doing things...it can cause more trouble than it is worth.You can use try catch staements to find errors. try{ ....do something...}catch(err){ alert(err.description); //error occured} Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted April 24, 2006 Author Share Posted April 24, 2006 that wouldn't help... They already know what the error is and what line it's on... now they have to press the down arrow 189 times just to find the line, hope they don't miss count. Link to comment Share on other sites More sharing options...
Little Goat Posted April 24, 2006 Share Posted April 24, 2006 why don't you just display the line numbers next to the lines?LG Link to comment Share on other sites More sharing options...
Webworldx Posted April 25, 2006 Share Posted April 25, 2006 I wrote a nice little snippet for this. Unfortunately Opera doesn't like scrollTop, but it works in Firefox and Internet Explorer http://www.ifcode.com/javascript/scroll_textarea.htmlI've set it to scroll to 98 as an example, but change the number sent to the function to scroll elsewhere. Link to comment Share on other sites More sharing options...
aspnetguy Posted April 25, 2006 Share Posted April 25, 2006 I wrote a nice little snippet for this. Unfortunately Opera doesn't like scrollTop, but it works in Firefox and Internet Explorer http://www.ifcode.com/javascript/scroll_textarea.htmlI've set it to scroll to 98 as an example, but change the number sent to the function to scroll elsewhere.<{POST_SNAPBACK}> Nice script Link to comment Share on other sites More sharing options...
Webworldx Posted April 25, 2006 Share Posted April 25, 2006 Thanks aspnetguy Link to comment Share on other sites More sharing options...
raimo Posted April 25, 2006 Share Posted April 25, 2006 I wrote a nice little snippet for this. Unfortunately Opera doesn't like scrollTop, but it works in Firefox and Internet Explorer http://www.ifcode.com/javascript/scroll_textarea.htmlI've set it to scroll to 98 as an example, but change the number sent to the function to scroll elsewhere.<{POST_SNAPBACK}> Very nice piece of code indeed! Opera case is funny, if You put div overflow to scroll ..scrollTop will work fine with Opera, but not with textarea.And I'm using newest Opera 9 available (Linux build 241). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now