473,382 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

javascript dies on IIS server

The script below loads a calendar page in an iframe and scrolls to
today's date.

It works just dandy on my apache/linux server, but won't do anything
when I use IIS. (Nothing appears on the page at all where the script is
at.)

I'd appreciate any suggestions on how to make this work from the IIS
server.

Thanks, in advance!

-Cloy
<script language="JavaScript" type="text/JavaScript">
<!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;

document.write
("<iframe name=\"Calendar\" width=\"215\" marginwidth=\"0\"
height=\"500\"
marginheight=\"0\" align=\"top\" scrolling=\"auto\" hspace=\"0\"
vspace=\"0\"
src=\"calendar.htm#" +
month + day + year
+ "\"");
//-->
</script>

Sep 29 '06 #1
5 1724
Errrrrrrr... first off language="JavaScript" needs to go. That's not
even JavaScript anymore...

Secondly, document.write dies MANY years ago. I would highly suggest
you learn DOM programming.

Third, check the content type IIS is sending the thing as. It may be
sending it as something stupid.

Cloy wrote:
The script below loads a calendar page in an iframe and scrolls to
today's date.

It works just dandy on my apache/linux server, but won't do anything
when I use IIS. (Nothing appears on the page at all where the script is
at.)

I'd appreciate any suggestions on how to make this work from the IIS
server.

Thanks, in advance!

-Cloy
<script language="JavaScript" type="text/JavaScript">
<!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;

document.write
("<iframe name=\"Calendar\" width=\"215\" marginwidth=\"0\"
height=\"500\"
marginheight=\"0\" align=\"top\" scrolling=\"auto\" hspace=\"0\"
vspace=\"0\"
src=\"calendar.htm#" +
month + day + year
+ "\"");
//-->
</script>
Sep 29 '06 #2
"Cloy" <cl**@tobola.comwrote in news:1159493073.870492.10680
@i3g2000cwc.googlegroups.com:
<script language="JavaScript" type="text/JavaScript">
<!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;

document.write
("<iframe name=\"Calendar\" width=\"215\" marginwidth=\"0\"
height=\"500\"
marginheight=\"0\" align=\"top\" scrolling=\"auto\" hspace=\"0\"
vspace=\"0\"
src=\"calendar.htm#" +
month + day + year
+ "\"");
//-->
</script>
I would start by rewriting the iframe to avoid using \" everywhere. Use
' on the outside and " inside it (or vice versa).

Sep 29 '06 #3
ag******@gmail.com said the following on 9/28/2006 11:00 PM:
Errrrrrrr... first off language="JavaScript" needs to go. That's not
even JavaScript anymore...
It never was Javascript to start with. It is an HTML attribute.
Secondly, document.write dies MANY years ago. I would highly suggest
you learn DOM programming.
That's idiotic. Sure, there are other ways to do it, but sometimes
document.write is just the simplest way.
Third, check the content type IIS is sending the thing as. It may be
sending it as something stupid.
And you think IE pays attention to content type? It tries to render
anything and everything.

Fourth, and most importantly, make sure you don't have a path/filename
collision.

Fifth, ignore idiotic top-posters.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Sep 29 '06 #4
ag******@gmail.com wrote:
Errrrrrrr... first off language="JavaScript" needs to go. That's not
even JavaScript anymore...
Please don't top-post, reply below trimmed quotes.

The language attribute never was part of JavaScript, it was introduced
as a deprecated attribute in HTML 4.

Secondly, document.write dies MANY years ago.
I doubt that you can find a visual UA with script support that doesn't
support it.

I would highly suggest you learn DOM programming.
Considering document.write() is a method of the document object, it
*is* "DOM programming".

Third, check the content type IIS is sending the thing as. It may be
sending it as something stupid.
I suppose you are referring to the possibility that the document is
being served as XHTML. In that case, document.write won't work - but
there is nothing to indicate that is the case.

Cloy wrote:
The script below loads a calendar page in an iframe and scrolls to
today's date.

It works just dandy on my apache/linux server, but won't do anything
when I use IIS. (Nothing appears on the page at all where the script is
at.)

I'd appreciate any suggestions on how to make this work from the IIS
server.

Thanks, in advance!

-Cloy
<script language="JavaScript" type="text/JavaScript">
<!--
Do not use HTML comments inside script elements, they are unnecessary.

var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
Better to use getFullYear() unless very old browser support is
required. Have you considered an "add leading zero" function?

function addZ(num){ return (num<10)? '0'+num : num;}

document.write
("<iframe name=\"Calendar\" width=\"215\" marginwidth=\"0\"
height=\"500\"
marginheight=\"0\" align=\"top\" scrolling=\"auto\" hspace=\"0\"
vspace=\"0\"
src=\"calendar.htm#" +
month + day + year
That seems an inappropriate choice of date format, why not use an ISO
format? Say yyyymmdd? Using addZ(), you can generate the date string
as:

var d = new Date();

document.write(
'<iframe ...
+ ' src="calendar.htm#' + d.getFullYear()
+ addZ(d.getMonth()+1) + addZ(d.getDate()+1)"'
);
+ "\"");
You don't seem to have properly closed the element, where is the
'></iframe>' string?
//-->
</script>

--
Rob

Sep 29 '06 #5
Hi,

Please look in the browser's source view, to see if the javascript has made
it to the client. If it has, then this has nothing to do with IIS. IIS just
sends the HTML, CSS, javascript etc to the client. It is up to the client to
parse/intepret the HTML, CSS, javascript etc

Cheers
Ken
"Cloy" <cl**@tobola.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
The script below loads a calendar page in an iframe and scrolls to
today's date.

It works just dandy on my apache/linux server, but won't do anything
when I use IIS. (Nothing appears on the page at all where the script is
at.)

I'd appreciate any suggestions on how to make this work from the IIS
server.

Thanks, in advance!

-Cloy
<script language="JavaScript" type="text/JavaScript">
<!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;

document.write
("<iframe name=\"Calendar\" width=\"215\" marginwidth=\"0\"
height=\"500\"
marginheight=\"0\" align=\"top\" scrolling=\"auto\" hspace=\"0\"
vspace=\"0\"
src=\"calendar.htm#" +
month + day + year
+ "\"");
//-->
</script>

Sep 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ken | last post by:
How do I send a variable, $validity from php and use it in JavaScript? Seem like PHP is written first, then html and JavaScript. Is it possible? Ken
2
by: leegold2 | last post by:
Can anyone recommend links that explain esp. show examples of how to use PHP and javascipt in the same page? Thanks. Lee G.
111
by: Retlak | last post by:
The recommended (on dozens of websites) and effective (works in Netscape, MSIE, Mozilla, probably others) way to detect if a browser has Javascript turned off is to put this in the <head>: ...
10
by: lkrubner | last post by:
I killed last night and a good chunk of today trying to figure out this one particular attempt to get a class and initialize it. My code is using a class method called getObject to include() a file...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
3
by: Kirk | last post by:
Let me start by saying that I am a complete idiot when it comes to JS. However, I need help with something that apparently can only be done this way. I am using an ASP.NET AJAX control...
5
Plater
by: Plater | last post by:
So after my previous troubles I now have asynchonous xmlHTTPRequests going. I send a request on an interval set for 5seconds. First the FF trouble: Sometimes when I refresh the page, I'll get an...
3
by: jehugaleahsa | last post by:
Hello: I have had a program that checks LDAP to get a list of all the users whose password will expire. I send these users an email letting them know to change their passwords. It had been...
15
by: Lawrence Krubner | last post by:
Does anything about this script look expensive, in terms of resources or execution time? This script dies after processing about 20 or 25 numbers, yet it leaves no errors in the error logs. This is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.