HighDots Forums  

Re: Need help with focus()

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: Need help with focus() in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dr John Stockton
 
Posts: n/a

Default Re: Need help with focus() - 06-27-2003 , 06:03 PM






JRS: In article <bdhkss$cfp$1 (AT) slb6 (DOT) atl.mindspring.net>, seen in
news:comp.lang.javascript, TSK <susannek (AT) mindspring (DOT) com> posted at Fri,
27 Jun 2003 10:36:54 :-

Quote:
My code is included below. Your help
will be greatly appreciated.
Code for News should be written with 72-character margin, or otherwise
arranged so that the sending newsreader does not wrap it. Why should we
have to tediously reassemble the pieces when you could so easily have
done it yourself?

The whole method is far too long.

<URL:http://www.merlyn.demon.co.uk/js-maths.htm#Base> does a similar
task in three lines of script :

function BCvt() { with (document.forms['Frm1']) {
out.value = parseInt(inp.value, inpbase.value).
toString(outbase.value).toUpperCase() } }

That converts from any base in 2..36 to any base in 2..36.

You test your input number. Easier to test it with a RegExp :

OK = /^\d+$/.test(inp.value) // is it just 1 or more digits?

after which +inp.value gets the value, as a Number, with no possible
error (except too big, which you did not test).

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MSIE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.