473,326 Members | 2,110 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,326 software developers and data experts.

problem with regular expressions, IE vs. firefox

cjl
Hey all:

Given the following code:

var ct_series = [21,23]
var cr_series = [12]

function preload()
{
for ( parm in window )
{
if ( parm.match('_series') )
{
alert("Found one!");
}
}
}

In firefox and mozilla I get the alerts, in IE I do not.

If I try:

function preload()
{
for (parm in window)
{
alert("Found one:" + parm);
}
}

I see the alerts in IE, so I know that IE can iterate through the
window object. But none of the alert boxes show cr_series or
ct_series. In fact, this same code in Firefox results in roughly three
times as many alerts, listing objects that were not listed when run
through IE.

Help?

-CJL

Jul 23 '05 #1
3 1639
cjl
Hey all:

If you've read this far, you realize that my subject line is wrong.

This is not a problem with regular expressions, but a problem with my
understanding of the window object.

I though global variables were attributes of the window object that I
could iterate through?

Maybe I should repost (double post) with a correct subject line.

-CJL

Jul 23 '05 #2
Lee
cjl said:

Hey all:

Given the following code:

var ct_series = [21,23]
var cr_series = [12]

function preload()
{
for ( parm in window )
{
if ( parm.match('_series') )
{
alert("Found one!");
}
}
}

In firefox and mozilla I get the alerts, in IE I do not. I see the alerts in IE, so I know that IE can iterate through the
window object. But none of the alert boxes show cr_series or
ct_series. In fact, this same code in Firefox results in roughly three
times as many alerts, listing objects that were not listed when run
through IE.


The for..in loop doesn't show all of the attributes of the object.
Different browsers can, and apparently do, choose to make different
attributes visible to it.

You might be better off using a custom Object. All attributes that
you add to a custom object are visible to for..in:

var global=new Object();
global.ct_series = [21,23]
global.cr_series = [12]

function preload()
{
msg="<html><body>";
for ( parm in global )

Jul 23 '05 #3
cjl
Lee:

Thank you, that makes sense, I wasn't sure. So I guess IE doesn't make
global variables visible to it.

And I guess by creating a custom object, my for loop iterates through
considerably fewer items and not all of the attributes of the window
object, which is nice.

-CJL

Jul 23 '05 #4

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

Similar topics

1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
2
by: Sehboo | last post by:
Hi, I have several regular expressions that I need to run against documents. Is it possible to combine several expressions in one expression in Regex object. So that it is faster, or will I...
5
by: Greg Vereschagin | last post by:
I'm trying to figure out a regular expression that will match the innermost tag and the contents in between. Specifically, the string that I am attempting to match looks as follows: ...
5
by: Kijak | last post by:
Hi, Im just starting working with REGEX and got a few problems. Could you tell me how to test if two strings can be found in another. ei: String to test: "This is a great car you got" Look...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
12
by: Vadim Guchenko | last post by:
Hello. I'm using the following code: <html> <head> <style type="text/css"> pre {display: inline;} </style> </head>
4
by: =?Utf-8?B?Y3VyaW91cw==?= | last post by:
I am using a RegularExpressionValidator to validate a TextBox. I use "^?+(\.*)?$" to check for a real number. The control works fine as long as the user enters something in the TextBox; it does not...
1
by: Allan Ebdrup | last post by:
I have a dynamic list of regular expressions, the expressions don't change very often but they can change. And I have a single string that I want to match the regular expressions against and find...
13
by: Wiseman | last post by:
I'm kind of disappointed with the re regular expressions module. In particular, the lack of support for recursion ( (?R) or (?n) ) is a major drawback to me. There are so many great things that can...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.