Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning HTML, XHTML, CSS, and JavaScript
This is the forum to discuss the Wrox book Beginning HTML, XHTML, CSS, and JavaScript by Jon Duckett; ISBN: 978-0-470-54070-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning HTML, XHTML, CSS, and JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 4th, 2011, 07:54 AM
Authorized User
Points: 128, Level: 2
Points: 128, Level: 2 Points: 128, Level: 2 Points: 128, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2011
Posts: 25
Thanks: 2
Thanked 1 Time in 1 Post
Default JavaScript

Does anyone know whats wrong with this code? The screen is blank, even though I enable and allow scripts and Active X conrols to be on. I've even tried putting the javascipt code in the body element instead of the head, but still nothing happens? any clues?

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Getting the date</title>



<script type="text/JavaScript">

date = new Date();
time = date.getHours();

if (time < 12) {
document.write("Good Morning");
}
if (time < 18 && time => 12) {
document.write("Good Afternoon");
}
if (time => 18 && time < 24) {
document.write("Good Evening");
}
</script>
</head>

</html>

Thanks
Reply With Quote
The Following User Says Thank You to crashbandicoot For This Useful Post:
unicode (April 27th, 2011)
  #2 (permalink)  
Old April 4th, 2011, 09:24 AM
Authorized User
Points: 448, Level: 7
Points: 448, Level: 7 Points: 448, Level: 7 Points: 448, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts
Default

Hi,

I guess it's a probem with the order of the equal / greater than signs.

This works for me (equal sign behind the greater than sign):

Code:
<script type="text/JavaScript">

date = new Date();
time = date.getHours();

if (time < 12) {
document.write("Good Morning");
}
if (time < 18 && time >= 12) {
document.write("Good Afternoon");
}
if (time >= 18 && time < 24) {
document.write("Good Evening");
}
</script>
Reply With Quote
The Following User Says Thank You to disel2010 For This Useful Post:
crashbandicoot (April 5th, 2011)
  #3 (permalink)  
Old April 27th, 2011, 06:14 AM
Registered User
 
Join Date: Apr 2011
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Default static, dynamic and properties window in javascript

<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<SCRIPT>
function properties_page()
{
for (var i in window)
{
document.write (“Window property(” + i + “): ” +
window[i] + “<BR>”);
}
}
</SCRIPT>
<script language=”JavaScript”>
function dynamic_page(){
open(“http://www.java2s.com”, “myChild”);
}
function static_page()
{
window.open(“http://www.w3schools.com/PHP/php_arrays.asp”, “newWin”,
“resizeable,menubar,toolbar”);
}
</script>
<form name=”form1″>
<input type=”button” name=”b1″ value=”dynamic Child” onClick=’dynamic_page()’>
<input type=”button” name=”b2″ value=”static resize” onClick=’static_page()’>
<input type=”button” name=”b3″ value=”properties_page” onClick=’properties_page()’>
</form>
</body>
</html>
unicodesystems
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
about javascript Edward Colins BOOK: Beginning ASP.NET 4 : in C# and VB 3 September 22nd, 2010 05:10 PM
Why do we need javascript Edward Colins BOOK: Beginning ASP.NET 4 : in C# and VB 7 September 19th, 2010 02:50 PM
about javascript imran_python ASP.NET 1.0 and 1.1 Basics 2 December 23rd, 2008 09:04 PM
stop current javascript function using javascript sakthi Javascript 3 June 2nd, 2008 03:30 PM
"text/javascript" and "javascript" rupen Javascript 1 June 24th, 2005 07:20 AM



All times are GMT -4. The time now is 12:56 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.