473,395 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

page error when loading...even though page works fine.

My page runs fine...I just get the yeld sign with a "!" in it.
Ok, I asked this question in the VBscript group and they tell me it's a
JavaScript issue even though I don't get the error until I introduce the
VBscript to the page. Please look at it.

I'm getting the following error message on my page.
The function
function formatCurrency(strValue)
11{
12 strValue2 = strValue.toString().replace(/\$|\,/g,'');
13 dblValue = parseFloat(strValue2);
14
15 blnSign = (dblValue == (dblValue = Math.abs(dblValue)));
16 dblValue = Math.floor(dblValue*100+0.50000000001);
17 intCents = dblValue%100;
18 strCents = intCents.toString();
19 dblValue = Math.floor(dblValue/100).toString();
20 if(intCents<10)
21 strCents = "0" + strCents;
22 for (var i = 0; i < Math.floor((dblValue.length-(1+i))/3); i++)
23 dblValue = dblValue.substring(0,dblValue.length-(4*i+3))+','+
24 dblValue.substring(dblValue.length-(4*i+3));
25 return (((blnSign)?'':'-') + '$' + dblValue + '.' + strCents);
26}

<script language="JavaScript">document.write(formatCurrenc y(<%=Request.Form
("total")%>))</script></span>

I get no errors if I take out the VB and use a real number...
<script language="JavaScript">document.write(formatCurrenc y(77))</script>

Any thoughts?
Jul 23 '05 #1
1 1452
Abby Lee wrote:
My page runs fine...I just get the yeld sign with a "!" in it.
Ok, I asked this question in the VBscript group and they tell me it's a
JavaScript issue even though I don't get the error until I introduce the
VBscript to the page. Please look at it.

I'm getting the following error message on my page.

The function
function formatCurrency(strValue)
11{
12 strValue2 = strValue.toString().replace(/\$|\,/g,'');
13 dblValue = parseFloat(strValue2);
14
15 blnSign = (dblValue == (dblValue = Math.abs(dblValue)));
16 dblValue = Math.floor(dblValue*100+0.50000000001);
17 intCents = dblValue%100;
18 strCents = intCents.toString();
19 dblValue = Math.floor(dblValue/100).toString();
20 if(intCents<10)
21 strCents = "0" + strCents;
22 for (var i = 0; i < Math.floor((dblValue.length-(1+i))/3); i++)
23 dblValue = dblValue.substring(0,dblValue.length-(4*i+3))+','+
24 dblValue.substring(dblValue.length-(4*i+3));
25 return (((blnSign)?'':'-') + '$' + dblValue + '.' + strCents);
26}

<script language="JavaScript">document.write(formatCurrenc y(<%=Request.Form
("total")%>))</script></span>
Load this into your browser and do View > Source on it, what does the source
code say?

I'm guessing that Request.Form("total") isn't what you think it is.
I get no errors if I take out the VB and use a real number...
<script language="JavaScript">document.write(formatCurrenc y(77))</script>


99% of the time when it works with a hard-coded value, but does not work when
interacting with server-side processing is because the server-side processing
is not generating the output you think it is generating. The trick to this is
to use View > Source to see the HTML/JavaScript the user agent is actually
receiving. I bet you'll discover that the output from the script is something
like:

<script language="JavaScript">document.write(formatCurrenc y()</script>
or
<script language="JavaScript">document.write(formatCurrenc y([object
Object])</script>

or something similar.
Lastly, use <script type="text/javascript">, the LANGUAGE attribute has been
deprecated. I mention it last because it has nothing to do with your current
problem.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: saayan | last post by:
Hi, I am using PHP 5.0.1 with Apache 2 on Win XP (SP2). My index.php file has require_once contents.php and also for functions.php. My contents.php file also has a require_once for...
1
by: BKM | last post by:
I've been using the following 2 ways to make sure my WebBrowser is finished loading a page before continuing with the next code. do:doevents:loop while WebBrowser.Busy do:doevents:loop until...
24
by: jrefactors | last post by:
I have an upload file operation in the web application. UploadForm.jsp is the form, and UploadAction.jsp is the form processing. The web server is Websphere. //UploadForm.jsp <FORM...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
23
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine...
1
by: Vlad | last post by:
Greetings: Here is scenario I hope to get help with. ASP.NET 1.1 page: page_load(){ ... btnSave.Attributes.Add("onclick", "MyClick()"); }
4
by: Nicolas R | last post by:
Hi all, Im trying to figure out how to display a 'loading' message when scripts are being executed, ie when the page is still not ready for interaction. This is for a web app which relies on...
3
by: randy.buchholz | last post by:
I have been encountering strange behaviour on client machines where the pages truncate the display in the middle of the page. At some point the browser just goes white from one line to the bottom...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.