473,657 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

if.. else if sentence

hi,
I got a problem with a standard if... else if sentence. Each one works
alone, (ie. putting a /*..*/ around one of the conditions)but by
combining them, only the first one triggers. The code :

function sjekk()
{
if (window.documen t.info.organisa sjon.value =='')
{
alert('hey!');
return(false);
}
else {
if (window.documen t.info.check_fe ste.checked == false)
{
var answer = confirm('Contin ue?');
if (answer) {
return (true);
}
else {
return(false);
}
}
}
}

obscurr
Jul 20 '05 #1
3 8502
Obscurr wrote:
hi,
I got a problem with a standard if... else if sentence. Each one works
alone, (ie. putting a /*..*/ around one of the conditions)but by
combining them, only the first one triggers. The code :

function sjekk()
{
if (window.documen t.info.organisa sjon.value =='')
{
alert('hey!');
return(false);
}
else {
if (window.documen t.info.check_fe ste.checked == false)
{
var answer = confirm('Contin ue?');
if (answer) {
return (true);
}
else {
return(false);
}
}
}
}

obscurr


Use alert("I am here!") in different places and see if the satement is
reached.
It is the very old timers approach, but always works.

If a certain line is not reached allthough you expected it to be reached,
you know where to start debugging.

Hope that helps.

Regards,
Erwin
Jul 20 '05 #2
Lee
Obscurr said:

hi,
I got a problem with a standard if... else if sentence. Each one works
alone, (ie. putting a /*..*/ around one of the conditions)but by
combining them, only the first one triggers. The code :
This doesn't address your problem directly, but it might
help if you simplify your code:
if (window.documen t.info.check_fe ste.checked == false)
{
var answer = confirm('Contin ue?');
if (answer) {
return (true);
}
else {
return(false);
}
}


can be written as:

if (!window.docume nt.info.check_f este.checked)
{
return(confirm( 'Continue?'));
}

Jul 20 '05 #3
In the original code if "window.documen t.info.organisa sjon.value !=
''" and "window.documen t.info.check_fe ste.checked == true" nothing is
returned.

Try:

function sjekk()
{
var answer = false;
if (window.documen t.info.organisa sjon.value =='')
{
alert('hey!');
}
else
{
if (window.documen t.info.check_fe ste.checked == false)
{
answer = confirm('Contin ue?');
}
}

return answer;
}

ob*****@hotmail .com (Obscurr) wrote in message news:<44******* *************** ***@posting.goo gle.com>...
hi,
I got a problem with a standard if... else if sentence. Each one works
alone, (ie. putting a /*..*/ around one of the conditions)but by
combining them, only the first one triggers. The code :

function sjekk()
{
if (window.documen t.info.organisa sjon.value =='')
{
alert('hey!');
return(false);
}
else {
if (window.documen t.info.check_fe ste.checked == false)
{
var answer = confirm('Contin ue?');
if (answer) {
return (true);
}
else {
return(false);
}
}
}
}

obscurr

Jul 20 '05 #4

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

Similar topics

10
2082
by: Sidhu | last post by:
Hoe to relplace the word in sentence? Can any one send program?
6
1958
by: mike | last post by:
Hello, I am trying to write some code to parse a sentence and hyperlink just the words in it. I used Aaron's code from an earlier question as a start. So far, all the code does below is hyperlink everything separated by a space, which means stuff like "work." "happy." "Well;" "not." from the sentence become hyperlinks (whereas im interested in just the words themselves becoming hyperlinks and the punctuation staying nonhyperlinks). ...
8
2485
by: Scott | last post by:
I would like to automatically change the first letter to upper case and keep the rest intact of each sentence on a control of a form, i.e., i am going to school. see you in the afternoon. -I am going to school. See you in the afternoon. Is there any functions to do this job? Thanks, Scott
3
5599
by: dalearyous | last post by:
ok basically i need to write a program that will replace normal words in a sentence with pirate words. the trick is it needs to be able to take two word phrases. i went about this two different ways: 2d array and hashmap. both have the problem of translating a phrase with two words. im running out of time and need help bad. HASHMAP WAY: import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.awt.*; import...
12
3980
by: jackson.rayne | last post by:
Hello, I am a javascript newbie and I'm stick at one place. I have a requirement where I will get a sentence in a variable example var v1 ="This is a sentence"
3
5030
by: dmalhotr2001 | last post by:
Hi, For string extraction function in vb, if I feed in a paragraph, how do I extract the first sentence of that paragraph. Thanks :D
19
66207
by: fellya | last post by:
Hi, i don't have enough experience in writing codes in Python but now i'm trying to see how i can start using Python. I've tried to write a simple program that can display a sentence. now my problem is how to write a code using split function to split that sentence into words then print out each word separately. let me give u an example: >>>sentence=" My question is to know how to write a code in Python" then the output of this...
1
4342
by: fellya | last post by:
Hi, i don't have enough experience in writing codes in Python but now i'm trying to see how i can start using Python. I've tried to write a simple program that can display a sentence. now my problem is how to write a code using split function to split that sentence into words then print out each word separately. let me give u an example: >>>sentence=" My question is to know how to write a code in Python" then the output of this...
4
3700
by: xhani | last post by:
Hi , can anyone help me about writing a given sentence in Floyd's triangle . e.g , printf("Write a sentence:\n"); sentence=getchar(); ( I should not use arrays , functions,pointers) and as a sentence this one is given , e.g. helloworld!
0
8310
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
8826
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...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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,...
0
8605
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 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...
0
7330
agi2029
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...
0
5632
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();...
0
4155
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...
2
1615
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.