Click here to Skip to main content
15,896,063 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionFacebook share button is not working Pin
Member 803236014-Mar-14 21:46
Member 803236014-Mar-14 21:46 
AnswerRe: Facebook share button is not working Pin
ZurdoDev20-Mar-14 15:41
professionalZurdoDev20-Mar-14 15:41 
GeneralRe: Facebook share button is not working Pin
Sunasara Imdadhusen26-May-14 21:24
professionalSunasara Imdadhusen26-May-14 21:24 
Questionddslick set Max height Pin
saigowthami14-Mar-14 17:24
saigowthami14-Mar-14 17:24 
SuggestionRe: ddslick set Max height Pin
ZurdoDev20-Mar-14 15:43
professionalZurdoDev20-Mar-14 15:43 
Questionpop window Pin
Member 1003910910-Mar-14 20:33
Member 1003910910-Mar-14 20:33 
SuggestionRe: pop window Pin
ZurdoDev20-Mar-14 15:45
professionalZurdoDev20-Mar-14 15:45 
QuestionTrying to compare cancel from prompt dialog not working Pin
RabbitTrail10-Mar-14 11:43
RabbitTrail10-Mar-14 11:43 
Below I have the code I am working with. The if statement in the script is not working. What I want to do is catch the value of the prompt dialog box if the user clicks the cancel buttom and exit the script if that is the case. I have tried:

if (color=="null")
if (color==="null")
if (color=='null')
if (color==='null')
if (color==null)
if (color===null)

and none of them work. I can make the script work if I do:
if(color!=null) and modify the logical processing
but I am trying to make work with the equals comparison.

If I comment out the if conditional statement, it works fine.
Any help is greatly appreciated. Thank you.

<script type="text/javascript">
<!--
var color = prompt("Enter a color","Enter red, white, or blue.")

function colorTest(){
       
        //********** if statement not working properly
	if(color === null){
		break;
	}

	switch(color){
	case "red":
		alert("You have entered the color ' red '");
		break;
	case "white":
		alert("You have entered the color ' white '");
		break;
	case("blue"):
		alert("You have entered the color ' blue '");
		break;
	default:
		alert("You did not enter a valid color");
		
	}
}//end function

//-->
</script>


modified 10-Mar-14 19:32pm.

AnswerRe: Trying to compare cancel from prompt dialog not working Pin
Kornfeld Eliyahu Peter10-Mar-14 21:57
professionalKornfeld Eliyahu Peter10-Mar-14 21:57 
AnswerRe: Trying to compare cancel from prompt dialog not working Pin
ZurdoDev13-Mar-14 6:44
professionalZurdoDev13-Mar-14 6:44 
AnswerRe: Trying to compare cancel from prompt dialog not working Pin
twseitex13-Mar-14 9:28
twseitex13-Mar-14 9:28 
QuestionHow to write confirmation message? Pin
Member 1062605710-Mar-14 0:08
Member 1062605710-Mar-14 0:08 
AnswerRe: How to write confirmation message? Pin
thatraja10-Mar-14 2:29
professionalthatraja10-Mar-14 2:29 
GeneralRe: How to write confirmation message? Pin
Member 1062605710-Mar-14 2:45
Member 1062605710-Mar-14 2:45 
GeneralRe: How to write confirmation message? Pin
thatraja10-Mar-14 2:59
professionalthatraja10-Mar-14 2:59 
GeneralRe: How to write confirmation message? Pin
Praneet Nadkar4-May-14 23:22
Praneet Nadkar4-May-14 23:22 
GeneralRe: How to write confirmation message? Pin
thatraja4-May-14 23:28
professionalthatraja4-May-14 23:28 
GeneralRe: How to write confirmation message? Pin
Praneet Nadkar4-May-14 23:40
Praneet Nadkar4-May-14 23:40 
AnswerRe: How to write confirmation message? Pin
Praneet Nadkar4-May-14 23:39
Praneet Nadkar4-May-14 23:39 
Questionconsume external WCF REST services using Angular.js Pin
ramsai19737-Mar-14 1:14
ramsai19737-Mar-14 1:14 
AnswerRe: consume external WCF REST services using Angular.js Pin
Jellali Tarek7-Mar-14 4:38
Jellali Tarek7-Mar-14 4:38 
AnswerRe: consume external WCF REST services using Angular.js Pin
petra.elhashem7-Mar-14 10:30
petra.elhashem7-Mar-14 10:30 
Questionbody onunload Pin
RabbitTrail6-Mar-14 16:26
RabbitTrail6-Mar-14 16:26 
AnswerRe: body onunload Pin
vbmike7-Mar-14 3:39
vbmike7-Mar-14 3:39 
AnswerRe: body onunload Pin
twseitex13-Mar-14 9:33
twseitex13-Mar-14 9:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.