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>
7 ответов
+ 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)' ;)
+ 2
you should try comparing your qry variable with something, like:
if(qry == "yes" || qry == "y"){
alert("Deleted!");
}
+ 1
not check condition
+ 1
Thanks
0
so what is the error here?
0
It would be nice if you add this to your codes and give a link. I can suggest the corrections easily.
0
thanks a lot