Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / September 2006



Tip: Looking for answers? Try searching our database.

javascript dies on IIS server

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cloy - 29 Sep 2006 02:24 GMT
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>
agapeton@gmail.com - 29 Sep 2006 04:00 GMT
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.

> The script below loads a calendar page in an iframe and scrolls to
> today's date.
[quoted text clipped - 30 lines]
> //-->
> </script>
Randy Webb - 29 Sep 2006 05:34 GMT
agapeton@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.

Signature

Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

RobG - 29 Sep 2006 06:28 GMT
> 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.

> > The script below loads a calendar page in an iframe and scrolls to
> > today's date.
[quoted text clipped - 12 lines]
> > <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();
[quoted text clipped - 3 lines]
> > 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\"
[quoted text clipped - 3 lines]
> > 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>

Signature

Rob

Jim Land - 29 Sep 2006 04:41 GMT
"Cloy" <cloy@tobola.com> wrote in news:1159493073.870492.10680
@i3g2000cwc.googlegroups.com:

> <script language="JavaScript" type="text/JavaScript">
> <!--
[quoted text clipped - 16 lines]
> //-->
> </script>

I would start by rewriting the iframe to avoid using \" everywhere.  Use
' on the outside and " inside it (or vice versa).
Ken Schaefer - 30 Sep 2006 04:54 GMT
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

> The script below loads a calendar page in an iframe and scrolls to
> today's date.
[quoted text clipped - 30 lines]
> //-->
> </script>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.