473,762 Members | 8,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE error using setTimeout and Select Tag in a frame.

Hi,

I've got a funny and wanted to know if there is a fix out there for
this.

I display a jsp inside a frame that monitors the database and reloads
itself via the setTimeout js function. To improve functionality I
added a dropdown where the user can select the frequency of reloading.

The bug is this: Let the page reload by itself. Then click on the
dropdown and do not select a value, just leave it open until the page
reloads itself. You should get a blank page. Any ideas?

** test.jsp
<%
try {
String MILLIS = request.getPara meter("mills");

int millis = 15000;

if (MILLIS != null && MILLIS.equals(" ") == false) {
millis = Integer.parseIn t(MILLIS) * 1000;
} else {
MILLIS = "15";
}

System.out.prin tln("here...");
System.out.prin tln("millis = " + millis);
%>

<html>
<head>
<title>Test</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" CONTENT="0">
<script>
function reload()
{
setTimeout('doc ument.mon.submi t();', <%=millis%>);
}
reload();
</script>
</head>
<body>
<%=new java.util.Date( )%>
<form name="mon" class="form" >
Update this page every
<select name="mills" onchange="javas cript:document. mon.submit();">
<option value="7" <% if ("7".equals(MIL LIS)) { %>selected<% }
%>>7 seconds</option>
<option value="15" <% if ("15".equals(MI LLIS)) { %>selected<% }
%>>15 seconds</option>
<option value="30" <% if ("30".equals(MI LLIS)) { %>selected<% }
%>>30 seconds</option>
</select>
</form>
</body>
</html>
<%
System.out.prin tln("here too...");

} catch (Exception e) {
System.out.prin tln("e.getMessa ge() = " + e.getMessage()) ;
e.printStackTra ce();
}
%>
** end

Thanks,
Martin
Jul 20 '05 #1
8 4045
Martin wrote:
The bug is this: Let the page reload by itself. Then click on the
dropdown and do not select a value, just leave it open until the page
reloads itself. You should get a blank page. Any ideas?
Don't post server-side script code, post what the client gets (see
`view-source:$URI', Edit, View Source e.g.) instead. When you look
at the generated code, you will most certainly find the error for
yourself. Try `javascript:' in the Location Bar and enable the
display of script errors in Internet Options, too.
onchange="javas cript:document. mon.submit();">


`javascript:' URIs don't belong into event handlers. Within JavaScript
code, `javascript:' is merely a label. If supported, it is ignored (since
no statement refers to it.) If not supported, it results in a script error.
(If the UA uses the label as an identifier for the script language to be
used, it is b0rken since the default scripting language is defined with
the `meta' element in the `head'.)

And reference the form with the recommended (by
W3C-DOM 2 HTML) document.forms['mon'] instead.
PointedEars
Jul 20 '05 #2
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes:

[about onevent="javasc ript:..."]
(If the UA uses the label as an identifier for the script language to be
used, it is b0rken since the default scripting language is defined with
the `meta' element in the `head'.)


However, there is no way to have a script in a language different from
the default scripting language. That is probably why IE uses the label
to specify the language (as pretty much the only widely used browser that
supports more than one scripting langauge): You can have javascript
and vbscript on the same page that way.

I don't like it either, but given that there is no better alternative,
I can understand why they do it.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
Lasse Reichstein Nielsen wrote:
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes:
[about onevent="javasc ript:..."]
(If the UA uses the label as an identifier for the script language to be
used, it is b0rken since the default scripting language is defined with
the `meta' element in the `head'.)
However, there is no way to have a script in a language different from
the default scripting language.


You're wrong. I have posted (IE-)working examples with VBScript and
J(ava)Script here IIRC more than one time. Google is your friend. [psf 6.1]
That is probably why IE uses the label to specify the language (as pretty
much the only widely used browser that supports more than one scripting
langauge): You can have javascript and vbscript on the same page that way.
You can have that without a proprietary interpretation of labels.
I don't like it either, but given that there is no better alternative,
I can understand why they do it.


All scripts in a page share the same namespace, there is no need to define
what language is meant unless there is a subroutine with the same identifier
in languages different from the default scripting language. And if that, one
can encapsulate that ambiguous statement in user-defined subroutines with
different identifiers within `script' elements whose language is properly
enough defined by the `language' and/or the `type' attribute.
PointedEars
Jul 20 '05 #4
On Thu, 30 Oct 2003 21:10:40 +0100, Thomas 'PointedEars' Lahn
<Po*********@we b.de> wrote:
Lasse Reichstein Nielsen wrote:
However, there is no way to have a script in a language different from
the default scripting language.
You're wrong. I have posted (IE-)working examples with VBScript and
J(ava)Script here IIRC more than one time. Google is your friend. [psf 6.1]


Could you post a simple snippet which has different script languages
used in intrinsic events without using the script label syntax?
All scripts in a page share the same namespace, there is no need to define
what language is meant unless there is a subroutine with the same identifier
in languages different from the default scripting language.


I really don't understand this you're suggesting:

onload="if (1==2) alert('a')"

doesn't need to be told it's javascript because all scripts on the
page share the same namespace?

Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #5
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes:
You're wrong. I have posted (IE-)working examples with VBScript and
J(ava)Script here IIRC more than one time. Google is your friend. [psf 6.1]
You are probably referring to <news:3F******* *******@Pointed Ears.de>.

It is correct that you can circumvent the problem by using only one
language in the event handler attributes and using the other language
in global functions that can be called cross-language.

However, that still doesn't allow you to have JScript in one event
attribute and VBScript in another. IE's label interpretation does.

(Google did let me find "psf 6.1". Luckily, I can't seem to get it to
store the cookie with my configuration. Otherwise I wouldn't have found
a page in German :).
All scripts in a page share the same namespace, there is no need to define
what language is meant unless there is a subroutine with the same identifier
in languages different from the default scripting language. And if that, one
can encapsulate that ambiguous statement in user-defined subroutines with
different identifiers within `script' elements whose language is properly
enough defined by the `language' and/or the `type' attribute.


That avoids the problem, but it doesn't solve it.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #6
Jim Ley wrote:
Thomas 'PointedEars' Lahn wrote:
Lasse Reichstein Nielsen wrote:
However, there is no way to have a script in a language different
from the default scripting language.


You're wrong. I have posted (IE-)working examples with VBScript and
J(ava)Script here IIRC more than one time. Google is your friend.
[psf 6.1]


Could you post a simple snippet which has different script languages
used in intrinsic events without using the script label syntax?


As I wrote, I did it before:

http://groups.google.com/groups?q=vb...num=1&filter=0

The `foobar()' JavaScript call can be as well placed in an
event handler, provided that the default scripting language
is JavaScript because it is the only scripting language the
UA has a script engine for, or (better) because it is defined
as the default scripting language (see below.)
All scripts in a page share the same namespace, there is no need to
define what language is meant unless there is a subroutine with the
same identifier in languages different from the default scripting
language.


I really don't understand this you're suggesting:

onload="if (1==2) alert('a')"

doesn't need to be told it's javascript because all scripts on the
page share the same namespace?


No, it is considered to be JavaScript because of

<meta http-equiv="Content-Script-Type" content="text/javascript">

within the `head' element as recommended by the HTML 4.01 Specification.

The problem that can occur is that foobar() may be subroutine
intrinsic to more than one supported scripting language, say
FooScript and BarScript. Then you need to call that routine
from a function of which the scripting language is known:

<head>
...
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/fooscript">
func foo
foobar{}
cnuf
</script>

<script type="text/barscript">
(bar)
[
foobar();
]
</script>
...
</head>
<body>
...
<... onwhatever="foo (); bar();" ...>
...
</body>
PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
Tipp gegen Quellcode-Klau
<http://www.vortex-webdesign.com/help/hidesource.htm>
Jul 20 '05 #7
On Fri, 31 Oct 2003 03:21:49 +0100, Thomas 'PointedEars' Lahn
<Po*********@we b.de> wrote:
Jim Ley wrote:
You're wrong. I have posted (IE-)working examples with VBScript and
J(ava)Script here IIRC more than one time. Google is your friend.
[psf 6.1]
Could you post a simple snippet which has different script languages
used in intrinsic events without using the script label syntax?


As I wrote, I did it before:


Please lookup the usage of "intrinsic events" it's from the HTML
recommendation. Your example does not use different script languages
in intrinsic events.
onload="if (1==2) alert('a')"

doesn't need to be told it's javascript because all scripts on the
page share the same namespace?


No


So you are agreeing now with Lasse's original assertion, going back on
your "you're wrong"

|> However, there is no way to have a script in a language different from
|> the default scripting language.
|
|You're wrong.
The problem that can occur is that foobar() may be subroutine
intrinsic to more than one supported scripting language, say
FooScript and BarScript.
I didn't mention any function other than alert, that is not a problem
(although your claim that all languages on a page share the same
namespace is not actually sustainable, it's true to Windows IE, but
there is no requirement that it be true.
<... onwhatever="foo (); bar();" ...>


This relies on javascript (or whatever but a single language) Can you
please provide an example which backs up your previous assertion that
using the HTML 4 techniques does not limit you to one script language
in your intrinsic events.

The IE method of overriding the JScript label (perfectly legal to do
so in ECMAScript btw.) seems like an elegant solution.

Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #8
Jim Ley wrote:
Thomas 'PointedEars' Lahn wrote:
Jim Ley wrote:
You're wrong. I have posted (IE-)working examples with VBScript
and J(ava)Script here IIRC more than one time. Google is your
friend. [psf 6.1]

Could you post a simple snippet which has different script
languages used in intrinsic events without using the script label
syntax?
As I wrote, I did it before:


Please lookup the usage of "intrinsic events" it's from the HTML
recommendation.


There's no need, I know what I'm writing about.
Your example does not use different script languages in intrinsic
events.
I used subroutines from different script languages as I read you wanted
to see.
onload="if (1==2) alert('a')"

doesn't need to be told it's javascript because all scripts on
the page share the same namespace?


No


So you are agreeing now with Lasse's original assertion, going back
on your "you're wrong"


You misunderstood what I wrote.
|> However, there is no way to have a script in a language
|> different from the default scripting language.
|
| You're wrong.
Which is correct. We were talking about
scripts, not (intrinsic) event handlers.
<... onwhatever="foo (); bar();" ...>


This relies on javascript (or whatever but a single language)


Yes, of course. I did not dispute that.
The IE method of overriding the JScript label (perfectly legal to do
so in ECMAScript btw.)
According to ECMAScript Editions 1 and 3, section 12.12 (Ed. 2 does not
mention labels):

| A Statement may be prefixed by a label. Labelled statements are only
| used in conjunction with labelled break and continue statements.
seems like an elegant solution.


It *seems*, yes.
PointedEars
Jul 20 '05 #9

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

Similar topics

0
2069
by: Somerset Bob | last post by:
I've posted my query at the phpbb forum, where I got half an answer and then no more. I posted it again at another phpbb forum, where I got half an answer and no more. I posted it in alt.php, where I got half an answer, then no more. In desperation, I'm now posting again in alt.php, alt.comp.lang.php and comp.lang.php in the hope that someone will find the time to help. This was my original query:
5
5874
by: Thomas Hoheneder | last post by:
Hello, I have a web page that contains the following things. 1) Lots of text, so that the page is longer/higher than one browser screen. 2) Within that text there is an input text field. 3) On some place after there, there is a select tag. 4) I have the following div tag absolutely positioned on the page, somewhere between all the text. <div id="fixeddiv" style="position:absolute;left:0px;top:50px;width:300px;height:100px;border:s
6
4366
by: Charles Crume | last post by:
Hello; My index.htm page (www.charlescrumesoftware.com for those interested in looking) contains 3 frames (left = content, top right = logo, bottom right = navigation). This domain name is registered with www.mydomain.com and is stealth forwarded to www.ccthecomputerguy.com (where my *real* web site currently lives). FWIW, I do this because in the 8+ years I've been on the web, I've changed ISPs about 5 times and every change requires a...
1
2376
by: Knud | last post by:
I have a frameset where a hidden frame reloads every 5 seconds and collects data from the sever if there are any changes made in a database. The hidden page updates Div fields on other frames with the lastest information. This works great. The problem I have is that when the hidden frame reloads it steals focus from the main frame where a user can be entering information into a form. (This is very annoying. As tabing through form...
9
4529
by: CW | last post by:
I wrote an HTML based chat application. The front end is built entirely on HTML + javascript. Essentially, I have a hidden frame that's refreshed frequently and any new messages are displayed in another frame using document.write. My problem is that since chat screen can be obscured by other applications/windows, I have no way of informing users that new messages have arrived other than popping the window to the top using window.focus....
1
2311
by: rajesh | last post by:
var fixedX = -1 // x position (-1 if to appear below control) var fixedY = -1 // y position (-1 if to appear below control) var startAt = 0 // 0 - sunday ; 1 - monday var showWeekNumber = 0 // 0 - don't show; 1 - show var showToday = 1 // 0 - don't show; 1 - show var imgDir = "images/" // directory for images ... e.g. var imgDir="/img/" var gotoString = "Go To Current Month" var todayString = "Today is"
4
5234
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a javascript function which calls setTimeout and will process a second javascript function "Warn" just before the session expires. The Warn function displays an html page with a button. A second timer is started to cause the html page to close...
2
4549
by: germ | last post by:
doing a simple page webmethod call an a page via PageMethods works fine in ie7 & opera9 the same call on firefox ( and I assume netscape ) generates the following error : Error: " nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://hgha.gerzio.ca/ScriptResource.axd?d=3Ot8FdrYMQ58gwjNF6tbd8V5YtBKDtb8a6qI5cjRJWaZBQhYu2jjDRnc7N0IverhgY8x7LACpAIvqLPvNyERF0ui1Tz1p-s2eu0h41S_qMA1&t=633179517344763787 ::...
9
3204
by: ahilar12 | last post by:
1. <head> 2. <script type="text/javascript"> 3. </script> 4. </head> 5. <body> 6. <form> 7. <select name="team" id="mylist" > 8. <option></option> 9. <option>north</option> 10. <option>south</option>
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9378
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9927
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3914
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.