Jump to content

goto line function


dcole.ath.cx
 Share

Recommended Posts

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

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

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.

Nice script :)
Link to comment
Share on other sites

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.

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...