473,652 Members | 3,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.toStri ng().replace(/\$|\,/g,'');
13 dblValue = parseFloat(strV alue2);
14
15 blnSign = (dblValue == (dblValue = Math.abs(dblVal ue)));
16 dblValue = Math.floor(dblV alue*100+0.5000 0000001);
17 intCents = dblValue%100;
18 strCents = intCents.toStri ng();
19 dblValue = Math.floor(dblV alue/100).toString() ;
20 if(intCents<10)
21 strCents = "0" + strCents;
22 for (var i = 0; i < Math.floor((dbl Value.length-(1+i))/3); i++)
23 dblValue = dblValue.substr ing(0,dblValue. length-(4*i+3))+','+
24 dblValue.substr ing(dblValue.le ngth-(4*i+3));
25 return (((blnSign)?'': '-') + '$' + dblValue + '.' + strCents);
26}

<script language="JavaS cript">document .write(formatCu rrency(<%=Reque st.Form
("total")%>) )</script></span>

I get no errors if I take out the VB and use a real number...
<script language="JavaS cript">document .write(formatCu rrency(77))</script>

Any thoughts?
Jul 23 '05 #1
1 1483
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.toStri ng().replace(/\$|\,/g,'');
13 dblValue = parseFloat(strV alue2);
14
15 blnSign = (dblValue == (dblValue = Math.abs(dblVal ue)));
16 dblValue = Math.floor(dblV alue*100+0.5000 0000001);
17 intCents = dblValue%100;
18 strCents = intCents.toStri ng();
19 dblValue = Math.floor(dblV alue/100).toString() ;
20 if(intCents<10)
21 strCents = "0" + strCents;
22 for (var i = 0; i < Math.floor((dbl Value.length-(1+i))/3); i++)
23 dblValue = dblValue.substr ing(0,dblValue. length-(4*i+3))+','+
24 dblValue.substr ing(dblValue.le ngth-(4*i+3));
25 return (((blnSign)?'': '-') + '$' + dblValue + '.' + strCents);
26}

<script language="JavaS cript">document .write(formatCu rrency(<%=Reque st.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("t otal") isn't what you think it is.
I get no errors if I take out the VB and use a real number...
<script language="JavaS cript">document .write(formatCu rrency(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="JavaS cript">document .write(formatCu rrency()</script>
or
<script language="JavaS cript">document .write(formatCu rrency([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*****@agrico reunited.com>
comp.lang.javas cript 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
2730
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 functions.php. When this code is tested on one machine, it works fine. However on another machine with identical configuration (same PHP 5.0.1, XP+SP2, Apache 2), an error message appears :
1
21298
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 WebBrowser.ReadyState = STATE_COMPLETE (or something like that. I don't have the code in front of me) But, for some reason, occasionally the code continues past the loops even
24
2728
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 NAME="InputForm" ACTION="UploadAction.jsp" METHOD="POST" enctype=multipart/form-data> <input type="file" name="fileName"> //etc ...
5
2774
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 to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
9
3183
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 load with different data (locations, departments, etc.).
23
5917
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 on most machines, on some machines I experience this problem: When loading the page a window pops up that asks if I want to open the document show_page.asp. When I click "Open" Interdev pops up and opens up a
1
2173
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
2678
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 javascript to insert dom elements and do stuff, so the user must know when everything is ready to interact with. I tried using an interval which checks for a specific variable (page_loading) and when its set to false then the 'loading' message is...
3
1854
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 of the browser. No error shows, and the visible portions of the pages function normally. I can't find any way to reproduce. It will happen on different pages and will truncate at different points on the same page for different users and...
0
8367
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8279
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8811
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8467
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.