IITDU Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

JScript: alert boxes not appearing

2 posters

Go down

User verified solution JScript: alert boxes not appearing

Post by BIT0220-Iftekhar Fri Sep 09, 2011 4:18 am

I'm kinda newbie in JS and trying some basics. Going through Wrox's Beginning Jscript fourth edition.

I copied a piece of code from the book. Pasted them in notepad,saved it as .html and opened it with Firefox 5,like the book instructed. But the desired output is not there.
Below is my code -
Code:
<html>
<body bgcolor=”WHITE”>
<p>Paragraph 1</p>
<script type=”text/javascript”>
  // Script block 1
  alert(“First Script Block”);
</script>
<p>Paragraph 2</p>
<script type=”text/javascript”>
  // Script block 2
  document.bgColor = “RED”;
  alert(“Second Script Block”);
</script>
<p>Paragraph 3</p>
</body>
</html>

The book says,
"Save the file to your hard drive as ch1_examp2.htm and then load it into your browser. When you load
the page, you should see the first paragraph, Paragraph 1, followed by a message box displayed by the
first script block. The browser halts its parsing until you click the OK button"


But there was no alert box. Instead,a page like below appeared.
JScript: alert boxes not appearing Js_err10

Is there anything wrong with my code segment,or any other issue?


Last edited by BIT0220-Iftekhar on Fri Sep 09, 2011 5:15 am; edited 1 time in total
BIT0220-Iftekhar
BIT0220-Iftekhar
Administrator-RC

Course(s) :
  • BIT

Blood Group : B+
Posts : 434
Points : 630

http://iftekharunplugged.blogspot.com

Back to top Go down

User verified solution Re: JScript: alert boxes not appearing

Post by BIT0122-Amit Fri Sep 09, 2011 4:41 am

happens when you directly copy code from pdf.

Replace ->”<- with ->"<-

Clue-
type shift + '
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

User verified solution Re: JScript: alert boxes not appearing

Post by BIT0220-Iftekhar Fri Sep 09, 2011 5:01 am

well,I don't get your answer. Perhaps you worried about the quotation signs which didn't appear properly inside code tags.

Edit: I just got clarity of your answer. And it worked Very Happy
I'm afraid I wouldn't have figured it out ever.
A rep++ is worth too little for this help. Wink

BIT0220-Iftekhar
BIT0220-Iftekhar
Administrator-RC

Course(s) :
  • BIT

Blood Group : B+
Posts : 434
Points : 630

http://iftekharunplugged.blogspot.com

Back to top Go down

User verified solution Re: JScript: alert boxes not appearing

Post by BIT0122-Amit Fri Sep 09, 2011 5:15 am

Nope. Perhaps you didn't notice the quotation marks were appearing inside your notepad code inappropriately.

Lets try another way.
I said, this happens when you copy code from pdf directly instead of typing.

And I said, replace
Replace ->”<- with ->"<-

Lets try some zooming.
open your code in notepad, and then select all, make the font 26.
Now, after
Code:
<body bgcolor=”WHITE”>
Type this line, AGAIN.

I hope then you will understand what I am talking about
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

User verified solution Re: JScript: alert boxes not appearing

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum