|
Hi guys,
I'm working on a UI that doesn't want to cooperate. ...I figured I'd get a little fancy and I'm running into a little bit of trouble. I'm building an ASP.NET page (C# code behinds) that interfaces with a database table. ...The UI has a javascript "drop down" menu bar up top with a panel(with a couple of input fields and a query button) on the left of the screen, a grid to display the results of the query on the right of the screen, and an "Add" button below the grid. Clicking "Add" hides the grid and displays an "Admin" panel in its place ...blah blah blah. Ok...so there's an issue where the "Query" panel needs to be disabled(yet still visible) while the Admin panel is enabled so I figured I would simply create a div to overlay it and use css opacity to make it 50% opaque grey. ...I know that I ran across an article explaining how to do it but I cannot for the life of me find it with any kind of web search. Does anyone know what I'm talking about? Does anyone know where to find an example of what I'm seeking?
Welcome my son...Welcome..to the Machine
|
|
|
|
|
|
OK. I have tested this in IE 6 & 7 and FireFox and got the same results.
Adding these terms "t2 = 3.43 + 10.00 + 3.33;" produces an incorrect value. Expected value is 16.76, but we get 16.759999999999998. Copy and paste the html code below in notepad and save as an HTML file and run. Oddly, if you swap the first and last terms, you get the expected value. Any thoughts?
<html>
<script>
function Add()
{
var t = 0.0;
var val_1 = document.getElementById('val_1');
var val_2 = document.getElementById('val_2');
var val_3 = document.getElementById('val_3');
var total = document.getElementById('Total');
t = parseFloat(val_1.value) + parseFloat(val_2.value) + parseFloat(val_3.value);
total.value = t;
var t2 = 0;
t2 = 3.43 + 10.00 + 3.33;
//Switching the first and last term produces the correct value
//t2 = 3.33 + 10.00 + 3.43;
//alert(t2);
}
</script>
<input type="text" id="val_1" value="3.43"> +
<input type="text" id="val_2" value="10.00"> +
<input type="text" id="val_3" value="3.33"> = <input type="text" id="Total" value="">
<BR>
<input type="button" id="val_2" value="Add" onclick="Add();">
<BR><BR>
Another Test:
Switch 3.43 and 3.33 ("3.33 + 10.00 + 3.43") values and you get the correct value.
</html>
-- modified at 14:00 Wednesday 30th May, 2007
|
|
|
|
|
Pinhead_Me wrote: Oddly, if you swap the first and last terms, you get the expected value. Any thoughts?
Swap the first and third terms.
|
|
|
|
|
you missed your calling as a comedian.
Thanks for your valuable contribution.
|
|
|
|
|
|
floating point calculations are never exact, that's just how it is
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I agree, but why should the order of terms matter? Addition is commutative. That law should apply to the Math engine within Javascript. Right?
|
|
|
|
|
Probably because two of the numbers get added, then the third gets added to the result. So, the order of operations could make a difference to if the rounding error is introduced or not.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: floating point calculations are never exact, that's just how it is
Yes, it is... but it's pretty poor, really.... ok back in Alan Turing's day maybe, but here we are now with microchips that do a billion+ operations a second and still they can't get simple arithmetic right... I mean, if there's one thing computers should be good at, should be the best at, it's number-crunching, right?
Fred
|
|
|
|
|
Exactly. That's what prompted me to post this issue.
|
|
|
|
|
Sure - but at what point do you suggest we change how our processors fundamentally work with regard to floating point ? Instead, we have more expensive classes like Decimal which allow us to do more exact calculations, knowing the cost of them is not a big deal, because of how fast our processors are.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Such a discussion wuld soon lead into technical areas about the inner-workings of microschips I am not qualified to comment on - all I can say is that as an end-user it seems astonishing that to this day computers can still struggle with simple arithmetic. It's up to you tecchies to work out how to do it!
|
|
|
|
|
*grin* well, at it's core your PC is a souped up 286. So, the options are to abandon PCs for a new chip set, or live with it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I can live with it, but if I told my granny that my computer can't add up the poor woman would die laughing
|
|
|
|
|
Fred_Smith wrote: I mean, if there's one thing computers should be good at, should be the best at, it's number-crunching, right?
There is no problem to get it right, you just have to use the right tool. If you want exact calculations, you simply don't use a data type that does not produce exact results.
If you use the wrong tool, and then complain that it's the fault of the tool that the result isn't right, you are just being foolish. If you want to draw a straight line, you use a ruler. If you choose to use a banana instead, it's not the bananas fault that the result is not a straight line.
---
single minded; short sighted; long gone;
|
|
|
|
|
In iexplore 7, ftp directories are shown as list of files (links) and not icons, like in previous versions. How can i force a ftp directory to be shown directly in the windows explorer using frames??
<frameset rows="20%,*">
<frame name="superiord" target="inferiord" scrolling="auto" src="ftp_2.htm">
<frame name="inferiord" src="ftp://localhost/" scrolling="auto">
</frameset>
thanks in advance!!
|
|
|
|
|
Hi to all
I have been sitting with a problem for some time now, I would like to know if theres a way to cusomise the scrollbars on a Panel,
Please help
Le Roux Viljoen
Web Developer
PCW New Media
South African Branch
www.pcwnewmedia.com
|
|
|
|
|
Certainly - what would you like to do to them lol?
"Knock me down, I'll get straight back up again, I'll come back stronger than a powered up pacman"
(Lilly Allen / Kaiser Chiefs)
|
|
|
|
|
Well I would just like to change the appearance of the vertical scrollbar
Le Roux Viljoen
Web Developer
PCW New Media
South African Branch
www.pcwnewmedia.com
|
|
|
|
|
Hi all,
My requirement is like this.
I have one Text box and a value associated with that text box. Say the
Textbox name : Textbox3
and value : 5
Im writing a javascript associated with this textbox and the event is "onchange".When i clcik this text box im getting the name of the text box and the value associated with it and storing it in a cookie for later retrieval.The format in which i store is like this
Cookiename: Textbox3#5,
But when i have to delete the value from the text box i should also remove it from cokkie.That is im updating the cookie again.This i do by manipulating the value from a hidden text field that i use for temporary storage before writing it into cookie.So when im deleting the value from text box im first deleting the "Textbox3#5" format from hiddenfield.The name of the textbox could be deleted using the "Replace" method . I passsing the "this " object and using "hiddentext.replace(this.id+'#',"")". This will help me in removing the "Textbox3#" from the field, but im not able to delete the value in similar manner ,ie "hiddentext.replace(this.value,"")". Because the current value is nothing since i deleted it. So can anyone suggest me a way to delete the remaining part also ie "5" from "Textbox3#5".
Is there any method in javasript which helps in deleting characters by giving any generic character.Just like we use "*" if we dont know what will be the character in that position.
Thanks in advance
|
|
|
|
|
hello all
i want to create VBScript file which will check internet connectivity after every 5 min, if connection get loss it shows message & when connection again reconnect it shows connect message.
SP
--
Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.
|
|
|
|
|
I have a database(access) and Im tryin to connect my webpage so I can compare values.I have already uploaded values into a combo box so when i select a value I want the page to go to database and filter values by the selected item and then display them into a datagrid or something.
Any great ideas on how i can do this.Please help.Ive tried everything.
A code wud be nice
Here is my code
Ok.
Now you get to view all the telephone numbers
by department
Select
An Alphabet
None
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
<%
Dim Connection
Set Connection=Server.CreateObject("ADODB.Connection")
Dim ConnectionString
ConnectionString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= U:\Websites\Working Site\Home Page\Home Page\TelephoneList.mdb"
Connection.Open ConnectionString
%>
<%
Dim Recordset
Set Recordset=Server.CreateObject("ADODB.Recordset")
Dim Telephonelist
Telephonelist="SELECT * FROM TelephoneList where FilterByType = '" &
Recordset.Open Telephonelist, Connection
%>
<%
If Recordset.EOF Then
Response.Write("No records returned.")
Else
if (Telephone.Department.value == "None")
{
alert("Please select a value other than the one you selected");
Telephone.Department.focus();
return (false);
}
if (Telephone.Department.value == "A")
{
Telephonelist="SELECT * FROM TelephoneList where (FilterByKey=='A')
Do While NOT Recordset.Eof
Response.write Recordset("Name")
Response.write Recordset("Surname")
Response.write Recordset("Department")
Response.write Recordset("Xtension")
Response.write " "
Recordset.MoveNext
Loop
End If
%>
kagiso
|
|
|
|
|
One great idea is to use web services where you use xmlhttp object
Thanks & Regards
Navneet Hegde
Nashik
India
Develop2Program & Program2Develop
|
|
|
|
|
The Contents in HTML Table Cell fits the cell if nowrap is set.I am trying to display the contents of cell in tool tip ,that only part of the text gets displayed in each cell(Ex: for "Go to Texas" must be displayed as "Go to....) when given minimum width so that user has to move mouse over the cell to view the full text content in cell.I would appreciate any help from you.
Thanks in Advance
|
|
|
|