[Javascript] any way to add a zero to a number
Scott.Wiseman
swiseman at remax-cahi.com
Thu Jun 13 12:03:09 CDT 2002
where would I put this?
<the code>
<%
'---------------------------------------------------------------
'---------------------------------------------------------------
'---------------------GET offices FROM DATBASE------------------
'---------------------------------------------------------------
'---------------------------------------------------------------
dim OfficeNameNumber(2000),countarray
set cmd = nothing
set cmd = server.CreateObject("ADODB.COMMAND")
with cmd
.ActiveConnection = cnn
.CommandText = "get_active_offices"
.CommandType = adCmdStoredProc
end with
set rst = cmd.execute
DO WHILE not rst.eof
if rst("franchiseid") then
OfficeNameNumber(rst("franchiseid")) = rst("officename")
end if
rst.movenext
LOOP
' ReDim Preserve OfficeNameNumber(countarray)
rst.close
set rst = nothing
set cmd = nothing
'response.write "<p>"& OfficeNameNumber(789)
%>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
officearray = new Array(2000);
<% for x = lbound(OfficeNameNumber) to ubound(OfficeNameNumber) %>
<% if OfficeNameNumber(x) <> "" then %>
officearray[<%=right("0000"+x,4)%>]= '<%=
replace(OfficeNameNumber(x),"'","\'") %>';
<% end if %>
<%next%>
function getofficename(number,thefield)
{
if(officearray[number]>"")
{
thefield.value = officearray[number];
}
}
//-->
</script>
-----Original Message-----
From: Muchacho, Laurent (TWIi London) [mailto:LMuchacho at twii.net]
Sent: Thursday, June 13, 2002 10:05 AM
To: 'javascript at LaTech.edu'
Subject: FW: [Javascript] any way to add a zero to a number
Hi scott
I think Josiah Gordon already answer to that question
Laurent
-----Original Message-----
From: Josiah Gordon [mailto:jgordon at directfile.com]
Sent: 12 June 2002 02:01
To: javascript at LaTech.edu
Subject: RE: [Javascript] any way to add a zero to a number
Try creating a string variable and appending your variable to "000". In your
database read the var in as an int.
var str = "000";
var num = 1;
str += num;
document.write(str); // ==> 0001
That work?
Josiah Gordon
-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Scott.Wiseman
Sent: Tuesday, June 11, 2002 5:51 PM
To: 'javascript at LaTech.edu'
Subject: [Javascript] any way to add a zero to a number
I really want 0001
but I get 1..
this is not good
for my database
Scott
p.s. Thanks for everyone's help so far.
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
DISCLAIMER - The preceding e-mail message (including any attachments)
contains information that may be confidential, may be protected by the
attorney-client or other applicable privileges, or may constitute non-public
information. It is intended to be conveyed only to the designated
recipient(s) named above. If you are not an intended recipient of this
message, or have otherwise received it in error, please notify the sender by
replying to this message and then delete all copies of it from your computer
system. Any use, dissemination, distribution, or reproduction of this
message by unintended recipients is not authorized and may be unlawful. The
contents of this communication do not necessarily represent the views of
this company.
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list