can someone please tell me what is wrong with this function's syntax? it's not working for me... -
if (document.getElementById('DIVinvoicesubtotal').style.display = 'none' && document.getElementById('DIVgst').style.display = 'none' && document.getElementById('DIVqst').style.display = 'none' && document.getElementById('DIVhst').style.display = 'none';) {
-
form.invoicesubtotal.value="";
-
form.gst.value="";
-
form.qst.value="";
-
form.hst.value="";
-
form.invoicetotal.value = '$' + addCommas(invoicesubtotalVAR.toFixed(2)) + ' CAD';}
-
-
if (document.getElementById('DIVinvoicesubtotal').style.display = 'block' && document.getElementById('DIVgst').style.display = 'block' && document.getElementById('DIVqst').style.display = 'none' && document.getElementById('DIVhst').style.display = 'none';) {
-
form.invoicesubtotal.value = '$' + addCommas(invoicesubtotalVAR.toFixed(2)) + ' CAD';
-
form.gst.value = GST.toFixed(2);
-
form.qst.value="";
-
form.hst.value="";
-
form.invoicetotal.value = '$' + addCommas(SUBTOTALandGST.toFixed(2)) + ' CAD';}
-
is it not possible to write my "if" statement this way? or should it be something like:
if (document.getEl ementById('DIVi nvoicesubtotal' ).style.display ='block'=True
thanks in advance
7 8458
look ...
if u write if(i =5)
the condition is always true because the statement will be ...
if(i) that is ... if(5)
u r assigning the 5 to i.
but to check the value of i whether it is 5 or anything else..
try write ...
if(i == 5)...
it will work
look ...
if u write if(i =5)
the condition is always true because the statement will be ...
if(i) that is ... if(5)
u r assigning the 5 to i.
but to check the value of i whether it is 5 or anything else..
try write ...
if(i == 5)...
it will work
excusé-moi?
nope... simply adding two equal signs didn't work... i think i tried that 18 times before posting... here's an example of something that works: -
if (document.getElementById('DIVinvoicesubtotal').style.display = 'none' ) {
-
form.invoicesubtotal.value="";
-
form.gst.value="";
-
form.qst.value="";
-
form.hst.value="";
-
form.invoicetotal.value = '$' + addCommas(invoicesubtotalVAR.toFixed(2)) + ' CAD';}
-
however, the following DOESN'T work -
if (document.getElementById('DIVinvoicesubtotal').style.display = 'none' && document.getElementById('DIVgst').style.display = 'none' && document.getElementById('DIVqst').style.display = 'none' && document.getElementById('DIVhst').style.display = 'none';) {
-
form.invoicesubtotal.value="";
-
form.gst.value="";
-
form.qst.value="";
-
form.hst.value="";
-
form.invoicetotal.value = '$' + addCommas(invoicesubtotalVAR.toFixed(2)) + ' CAD';}
-
so the problem seems to be with adding multiple conditions using "&&" between the numerous "...style.displ ay='none'"...
the mystery continues...
It should work if:
1. use == instead of =
2. remove the semi-colon ( ; ) inside of the if conditon (after last 'none').
Also, separate each of the 3 conditions with paranthesis, like. - if ((x == 'none') && (y == 'none') && (z == 'none'))
If still fails, please include more sample code, if possible, and I'll try out locally.
It should work if:
1. use == instead of =
2. remove the semi-colon ( ; ) inside of the if conditon (after last 'none').
THANK YOU! seems to work now! it's strange how using one equal sign works if there only one condition, but it requires two equal signs if there are more, as well as that silly semi-colon (can't believe i missed the semi-colon)...
you've made my day ;-)
acoder 16,027
Recognized Expert Moderator MVP
THANK YOU! seems to work now! it's strange how using one equal sign works if there only one condition, but it requires two equal signs if there are more, as well as that silly semi-colon (can't believe i missed the semi-colon)...
you've made my day ;-)
One equal sign works for one condition because it is setting instead of comparing so it will always be true. Always use double equals for comparing.
acoder 16,027
Recognized Expert Moderator MVP
Also, separate each of the 3 conditions with paranthesis, like. - if ((x == 'none') && (y == 'none') && (z == 'none'))
If still fails, please include more sample code, if possible, and I'll try out locally.
btw, dorin, thanks for helping out. It's nice when people help out, especially new members.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Adam |
last post by:
I have a scrollbar that runs at the top of my page, I have it in a external
js file and call it in the head tags of the webpage code. can you one tell
me how to get this code to work with other browsers mainly Netscape 7 and
above. Currently it doesn't display.
this is the scroll bar code
Thanks
----------------------------------------------------------------------
|
by: InvisibleMan |
last post by:
Thanks in Advance for any help on this - its truely sending my
head in loops... so I appreciate your efforts!
okay, I have a javascript listed below that drops down submenus
contained within:
<div class="small" style="display: none" id="menu1_menu">
when the heading is clicked:
<a href=.. onClick="expandDiv('menu1')">
|
by: johkar |
last post by:
When the output method is set to xml, even though I have CDATA around
my JavaScript, the operaters of && and < are converted to XML character
entities which causes errors in my JavaScript. I know that I could
externalize my JavaScript, but that will not be practical throughout
this application. Is there any way to get around this issue? Xalan
processor. Stripped down stylesheet below along with XHTML output.
<?xml version='1.0'?>...
|
by: ratnakarp |
last post by:
Hi,
I have a search text box. The user enters the value in the text box and
click on enter button. In code behind on button click i'm writing the
code to get the values from the database and binding it to a repeater
control. This repeater control has multiple text boxes and buttons. Can
you please tell me how can i do paging in this case ?
I'm posting my code below. The problem is that if i click on
"AdjustThisAd" button, it opens...
|
by: drew197 |
last post by:
I am a newbie. I am editing someone elses code to make it compatible
with Firefox and Safari.
In IE, when you click on the proper link, a block of text is shown in a
nice paragraph form. But, in FireFox and Safari it appears as a narrow
column of text with only 2-3 words per line.
Here is the code:
function showAll()
| |
by: Bob Sanderson |
last post by:
I have a PHP web page which uses a HTML form. I would like to enter dates
into the date fields using a JavaScript calendar, similar to the way
phpMyAdmin does. Can anyone recommend a JavaScript that will do this?
Also, how can I add a button to a form to enter a NULL.
Thanks in advance.
|
by: Tarik Monem |
last post by:
I have been working on an all AJAX/DOM web site which is set to go live today and I thought I'd share my discoveries with all of you whom have helped me when I have encountered different issues along the way.
First, deep linking is not something that a completely AJAX web site should be able to do by it's very nature of everything being on one page basically. So how can a person deep link to something that is on one page?
This question...
|
by: giordan |
last post by:
Hi all!
I've wrote this code:
<script type="text/javascript">
var largImg;
var altImg;
var txtTop = '<b>Ottima scelta!</b> Ora compila il form e premi "Ricevi banner". Il codice HTML ti verrà mostrato in questa pagina e, per comodità, ti verrà inviato, via mail, all\'indirizzo da te fornito. Se invece vuoi cambiare il banner premi "Seleziona banner"';
var txtButton = 'Cambia banner';
var testo = '';
|
by: pyro169 |
last post by:
Hey I am making a tic tac toe game, im new to javascript, and when i make the game with 'buttons' and 'x' and 'o' it works perfectly, but i also made some pics and i can get the pics to show up, but i am unable to get the alerts to come up, and i cannot figure out how to make it so it wont allow you to click on the same block more then once.
this is my complete code (with the gifs i am trying to use) .. any help at all would be appreaciated
...
|
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...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |