 |
| Javascript General Javascript discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 12th, 2011, 04:04 PM
|
|
Registered User
|
|
Join Date: Feb 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Javascript Question
I found a web site that converts Excel worksheet to HTML.
First, I wanted to know if this code is javascript:
var c1C21=(((var_ls((c1C19),(5)))?(((v2n(c1C19))+(5))) :(((v2n(c1C19))-(5)))));
Second, is their a way to convert the above line to an Excel formula?
What does the var_ls and v2n represent in the above line?
Thanks
|
|

February 12th, 2011, 06:01 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Pretty hard to tell by this code alone. You can simplify it to this:
var c1C21 = var_ls(c1C19, 5) ? v2n(c1C19) + 5 : v2n(c1C19) - 5;
This says something like:
If var_ls(c1C19, 5) is null, then take v2n(c1C19) - 5, otherwise, take v2n(c1C19) + 5
I can only assume that var_ls and v2n are functions defined somewhere in your HTML page or JavaScript file.
Cheers,
Imar
|
|

February 12th, 2011, 06:16 PM
|
|
Registered User
|
|
Join Date: Feb 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks again for your help
Thanks for your reply!!
The code was taken from a web page source code.
The code was generated by a program using spreadsheet converter.
I was curious to know what the Excel formula was that was translated to javascript.
If you have any suggestion.
Thanks
|
|

February 12th, 2011, 06:21 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Again, hard to tell without seeing the code or original spread sheet. It might have been something like this:
=IF(ISBLANK(B7), B8 - 5, B9 - 5)
Cheers.
Imar
|
|

February 12th, 2011, 06:40 PM
|
|
Registered User
|
|
Join Date: Feb 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Possibility
Maybe the Excel formula may be:
var c1C21=(((var_ls((c1C19),(5)))?(((v2n(c1C19))+(5))) :(((v2n(c1C19))-(5)))));
var_ls might be the equivalent to MOD?
Not sure what v2n may be
Possible formula ==IF($C$19<5,$C$19+5,$C$19-5)
|
|

February 12th, 2011, 07:05 PM
|
|
Registered User
|
|
Join Date: Feb 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your help
Thanks again!!
|
|
 |