Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 23rd, 2011, 02:07 AM
Authorized User
 
Join Date: Sep 2008
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default "Error in use of Bolean type of Javascript."

"Error in use of Bolean type of Javascript."
Syntax error is coming in document.write(true*5+false*7=) in the following program:
1-<html><head><title>Conversion between types, Quotes, Formatting characters</title>
2-<body>
3-<script language="Javascript">
4-document.write("true*5+false*7=")
5-document.write(true*5+false*7=)
6-</script>
7-</body></html>
What’s wrong in the 5th line document.write(true*5+false*7=) of this program?
Thanks in advance.
__________________
How to do programming?
 
Old February 23rd, 2011, 04:30 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It's because you have an = sign at the end, remove that and it should be fine.

(Please do not include Google Analytics tracking script in questions on the forum unless your question relates directly to that.)
__________________
Joe
http://joe.fawcett.name/
 
Old February 23rd, 2011, 05:06 AM
Authorized User
 
Join Date: Sep 2008
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default Yea it worked, but I did not understand the reason

Yea it worked, but I did not understand the reason that why after excluding =, it worked fine, could you please explain.
__________________
How to do programming?
 
Old February 23rd, 2011, 06:57 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
(Please do not include Google Analytics tracking script in questions on the forum unless your question relates directly to that.)
That is actually a bug in the e-mail notificaton for this forum. Ran into that a couple of times as well. It seems that the code that sends the notifications adds it to messages that contain something like </body>. So you only see this in the e-mail, not the actual post....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Last edited by Imar; February 23rd, 2011 at 09:20 AM..
 
Old February 23rd, 2011, 09:18 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Thanks Imar and apologies to arbab, thanks for that. I wondered why I kept seeing it...
__________________
Joe
http://joe.fawcett.name/

Last edited by joefawcett; February 23rd, 2011 at 09:23 AM..
 
Old February 23rd, 2011, 09:23 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Because document.write is trying to evaluate the expression you give it.
Code:
(true*5+false*7=)
is not a vaild expression because it cannot be evaluated, you have an equals sign indicating an equation but nothing after it, what does it mean?
Code:
(true*5+false*7)
is a valid expression that evaluates to 5 as true converts to 1, false to 0 and multiplication has a higher priority than addition giving (1 * 5) + (0 * 7).
__________________
Joe
http://joe.fawcett.name/
 
Old February 25th, 2011, 01:57 AM
Authorized User
 
Join Date: Sep 2008
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Thumbs up Thanks for your guidance.

Yea such impressions document.write(1*15+0*7) multiplying the digits, thanks for your guidance.

__________________
How to do programming?





Similar Threads
Thread Thread Starter Forum Replies Last Post
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
Need code corrections "get sub or function not defined" error" bluesboytoo Excel VBA 1 October 22nd, 2009 11:12 PM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Reading a files general property of "Type of file" GregSivers Visual Basic 2008 Essentials 7 June 3rd, 2009 09:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.