0

Error

<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body bgcolor="sky"> <script type="text/javascript" language="javascript"> var qry=confirm( "are you sure to send this file to recycle bin ? " ); if(qry) document.write("the file is deleted"); else document.write ("welcome to java script"); </script> </body> </html>

3rd Feb 2018, 7:09 PM
lal bahadur Verma
lal bahadur Verma - avatar
7 Respuestas
+ 5
Your code is right, but you set bgcolor='sky' on the body element tag, wich is not valid, and so parsed as 0 (black), the same color as default for text, so you document.write black on black ^^ (try a <ctrl>+A to select all the text in the document, you will see the outputed text as it will be highligthed ;)) You could easily fix that by setting a valid color for the attribute (not a name, but a hexadecimal color value, even if the 'bgcolor' attribute is deprecated in html5 and should be replaced by css style declaration -- using 'background-color' property, wich accept html named colors) @Limitless: qry is set with the return value of confirm(), so true or false, and the test 'if (qry)' is as much valid as 'if (qry==true)' ;)
3rd Feb 2018, 10:28 PM
visph
visph - avatar
+ 2
you should try comparing your qry variable with something, like: if(qry == "yes" || qry == "y"){ alert("Deleted!"); }
3rd Feb 2018, 7:44 PM
Limitless
Limitless - avatar
+ 1
not check condition
3rd Feb 2018, 7:26 PM
lal bahadur Verma
lal bahadur Verma - avatar
+ 1
Thanks
3rd Feb 2018, 7:42 PM
lal bahadur Verma
lal bahadur Verma - avatar
0
so what is the error here?
3rd Feb 2018, 7:24 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar
0
It would be nice if you add this to your codes and give a link. I can suggest the corrections easily.
3rd Feb 2018, 7:39 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar
0
thanks a lot
4th Feb 2018, 2:29 AM
lal bahadur Verma
lal bahadur Verma - avatar