Results 1 to 6 of 6

Thread: script in iframe not showing in ff

  1. #1
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs down script in iframe not showing in ff

    i got a script that i know is cross-browser inside an aspx page loaded in an iframe in another page loaded in an iframe.
    the script is a countdown script that uses document.write to show the data and setTimeout to run the script every second.
    the problem is that it displays in ie but not in ff though the script itself does work with both.
    more so - the date to count to is generated dynamically like this:
    Code:
    <%
    Response.Write("<script language='javascript' type='text/javascript'>");
    Response.Write("var timerEnd = new Date(Date.UTC("+Request.QueryString["Year"]+","+Request.QueryString["Month"]+","+Request.QueryString["Day"]+", 0, 0, 0))");
    Response.Write("</script>");
    %>
    just b4 the script tag.
    any ideas?
    p.s. i use the strict doctype.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Your asp code wasn't working in either browser here. This worked in both:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <%
    Response.Write("<script type='text/javascript'>")
    Response.Write("var timerEnd = new Date(Date.UTC("+Request.QueryString("Year")+","+Request.QueryString("Month")+","+Request.QueryString("Day")+", 0, 0, 0))")
    Response.Write("</script>")
    %>
    <script type="text/javascript">
    alert(timerEnd);
    </script>
    </head>
    <body>
    
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy still problem -

    well - i tried what u wrote (with the round brackets) but that doesn't even load.
    I can only see now the static text, not the changing text.
    This is the content of my TimeTo.aspx:
    Code:
    <%@ Page language="c#" Codebehind="TimeTo.aspx.cs" AutoEventWireup="false" Inherits="Site.TimeToW2" %>
    <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd">
    <HTML>
    	<HEAD>
    		<title>TimeToW</title>
    		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    		<meta content="C#" name="CODE_LANGUAGE">
    		<meta content="VBScript" name="vs_defaultClientScript">
    		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    		<LINK title="Blue" href="Blue.css" type="text/css" rel="stylesheet"
    		<script src="styleswitch.js" type="text/javascript"></script>
    		<%
    			Response.Write("<script type='text/javascript'>");
    			Response.Write("var timerEnd = new Date(Date.UTC("+Request.QueryString["Year"]+","+Request.QueryString["Month"]
    
    +","+Request.QueryString["Day"]+", 0, 0, 0))");
    			Response.Write("</script>");
    		%>
    		<script language="javascript">
    			function startTimer()
    			{
    				var DSTAdjust = 0;
    				var oneMinute = 1000 * 60;
    				var oneDay = oneMinute * 60 * 24;
    				var expired = '0';
    				time = new Date();
    				if (time.getTime() < timerEnd.getTime())
    				{
    					DSTAdjust = (timerEnd.getTimezoneOffset( )/60) * -1;
    					DSTAdjust = DSTAdjust*oneMinute*60;
    					var diff = timerEnd.getTime( ) - time.getTime( ) - DSTAdjust;
    
    					var hours = Math.floor(diff/(60*oneMinute));
    					var minutes = Math.floor(diff/oneMinute) % 60;
    					var seconds = Math.floor(diff/1000) % 60;
    				}
    				else
    				{
    					if (time.getDate() > timerEnd.getDate())
    					{
    						expired = '2';
    					}
    					else
    					{
    						expired = '1';
    					}
    				}
    				switch (expired)
    				{
    					case '0':
    					{
    						
    						document.getElementById('hours1').innerHTML = Math.floor(hours/10);
    						document.getElementById('hours0').innerHTML = hours % 10;
    		
    						document.getElementById('mins1').innerHTML = Math.floor(minutes/10);
    						document.getElementById('mins0').innerHTML = minutes % 10;
    
    						document.getElementById('secs1').innerHTML = Math.floor(seconds/10);
    						document.getElementById('secs0').innerHTML = seconds % 10;
    
    						setTimeout('startTimer()', 100);
    						break;
    					}
    					case '1':
    					{
    						document.getElementById('mins1').innerHTML = "<big>היום</big>";
    						break;
    					}
    					case '2':
    					{
    						document.getElementById('mins1').innerHTML = "<big>עבר</big>";
    						break;
    					}
    					default:
    					{
    						break;
    					}
    				}
    			}
    			
    			document.write("<table id='timer' align='center' class='timer' cellpadding='0' cellspacing='0'>"+
    			"<tr><td id='hours1'></td><td id='hours0'></td><td>&nbsp;</td><td id='mins1'></td><td id='mins0'></td><td>&nbsp;</td><td 
    
    id='secs1'></td><td id='secs0'></td></tr>"+
    			"<tr class='labels'><td colspan='2' align='center'>hours</td><td>&nbsp;</td><td colspan='2' 
    
    align='center'>mins</td><td>&nbsp;</td><td colspan='2' align='center'>secs</td></tr></table>");
    			window.onload=startTimer;
    		</script>
    	</HEAD>
    <BODY>
    </BODY>
    </HTML>

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I tried the asp code out on an asp enabled server. Perhaps your server is different. Or, were you even trying this on a server? Also, this:

    Code:
    <%@ Page language="c#" Codebehind="TimeTo.aspx.cs" AutoEventWireup="false" Inherits="Site.TimeToW2" %>
    changes the server side language, I believe, from VBscript to c#, which would explain at least why you were having trouble with my asp/VBscript code. This really isn't a javascript question, you should go to the asp section or perhaps to another asp forum. You do need someone with some javascript knowledge (I have tons of that), but also with c# (not me) and asp (I only have some asp experience).

    Sorry I can't be of much more help. If I had a link to the live page, I might be able to pick up on a few things from the generated source - that would be in javascript and HTML. I'm real good with those.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Another thing occurs to me, looking at your code. Try getting rid of one or more of these meta tags in turns:

    Code:
    		<meta content="C#" name="CODE_LANGUAGE">
    		<meta content="VBScript" name="vs_defaultClientScript">
    		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    If doing that fixes it fine. On the other hand, if doing that breaks it in IE, that probably means that some portion of your client side code is IE only.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I know I may have lost you here but, another thought occurs to me. The server side of this script has to execute identically, regardless of the browser. So, it would have to be something with the way that FF is interpreting the generated and/or the literal code on the client side.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •