Wrox Programmer Forums
| 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 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
  #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
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>
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


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





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