Message-ID: <400BED8A.7020003@adelphia.net>
Wow I never knew you could do that... thanks!
Roger Roelofs wrote:
> Brian,
>
> It isn't a javascript solution, but it should work. Use css to define
> a background image for the image. See the sample page below. I
> tested it in Safari, but not in anything else yet.
>
> -------
>
>
> Testing...
>
>
>
>
>
>
> -----------
>
> Roger
> -------------------------------------------------------
> Roger Roelofs web www.datacompusa.com
> Datacomp Appraisal Services web www.mhvillage.com
> 3215 Eaglecrest Drive, NE Email rer at datacompusa.com
> Grand Rapids, MI 49525-4593
>
> On Jan 18, 2004, at 3:00 PM, Brian Gordon wrote:
>
>> Is there any way to display a "loading" graphic in the place of the
>> real graphic while the real graphic is preloading? Also, are there
>> any JS image manipulation tools/functions?
>> _______________________________________________
>> Javascript mailing list
>> Javascript at LaTech.edu
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
From javascript at mattbarton.org Mon Jan 19 11:10:16 2004
From: javascript at mattbarton.org (Matt Barton)
Date: Mon, 19 Jan 2004 17:10:16 -0000
Subject: [Javascript] Using the popup object in IE
Message-ID: <20040119171013.mattski@plus.net>
Hi,
This isn't purely a javascript problem this, more like dHTML as it
contains a deal of css. Also, to make matters more evil, I'm only
concerned with finding a solution for IE5.5+ (not my descision - it was
made before I joined the company!).
What I'm trying to do is create a popup dHTML menu using the popup object.
I have a popup window appearing and it's appearance is about right (it's
content is defined by setting its innerHTML property). On the window is a
set of nested tables that describe a menu. The problem I am seeing is
that I cannot seem to trigger calls to functions from the event bound to
the objects. For instance this will trigger an alert box when you
click the correct cell:
However - this example will _not_ trigger an alert box....
Strange, no? I'm thinking that I've done something really basic and dumb
wrong, and I've been looking at it for so long that I just can't see it.
Can anyone help?
Thanks,
Matt
Oh - in case you want to see how I'm creating and displaying the popup
object, this is an example of code:
----
Hovering over the image causes the popup to display. The observant
amongst you will notice that most of the above code was, ahem, sourced
(robbed) from the M$ support site. The example snippets of code that I
use to explain the problem would be included in the popup_source3.html
file which the browser downloads.
From peter at brunone.com Mon Jan 19 11:31:49 2004
From: peter at brunone.com (Peter Brunone)
Date: Mon, 19 Jan 2004 11:31:49 -0600
Subject: [Javascript] Using the popup object in IE
In-Reply-To: <20040119171013.mattski@plus.net>
Message-ID: <00b501c3deb2$1ecbbf00$0502a8c0@monkeyhouse>
Matt,
I have IE 6, and all of your code works just fine for me.
-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu] On Behalf Of Matt Barton
Sent: Monday, January 19, 2004 11:10 AM
To: javascript at LaTech.edu
Subject: [Javascript] Using the popup object in IE
Hi,
This isn't purely a javascript problem this, more like dHTML as it
contains a deal of css. Also, to make matters more evil, I'm only
concerned with finding a solution for IE5.5+ (not my descision - it was
made before I joined the company!).
What I'm trying to do is create a popup dHTML menu using the popup
object. I have a popup window appearing and it's appearance is about
right (it's content is defined by setting its innerHTML property). On
the window is a set of nested tables that describe a menu. The problem
I am seeing is that I cannot seem to trigger calls to functions from the
event bound to the | objects. For instance this will trigger an
alert box when you click the correct cell:
However - this example will _not_ trigger an alert box....
Strange, no? I'm thinking that I've done something really basic and
dumb wrong, and I've been looking at it for so long that I just can't
see it.
Can anyone help?
Thanks,
Matt
Oh - in case you want to see how I'm creating and displaying the popup
object, this is an example of code:
----
Hovering over the image causes the popup to display. The observant
amongst you will notice that most of the above code was, ahem, sourced
(robbed) from the M$ support site. The example snippets of code that I
use to explain the problem would be included in the popup_source3.html
file which the browser downloads.
From javascriptlist at dandemutande.org Mon Jan 19 11:33:24 2004
From: javascriptlist at dandemutande.org (Paul Novitski)
Date: Mon, 19 Jan 2004 09:33:24 -0800
Subject: [Javascript] Using the popup object in IE
In-Reply-To: <20040119171013.mattski@plus.net>
References: <20040119171013.mattski@plus.net>
Message-ID: <6.0.1.1.2.20040119093047.01d20db8@spamarrest.com>
Matt,
FYI, your second code snippet *DID* work for me when I enclosed it in html
& body tags, running on IE 6.0.26.
Paul
At 09:10 AM 1/19/2004, you wrote:
...
>However - this example will _not_ trigger an alert box....
>
>
>
...
From javascript at mattbarton.org Mon Jan 19 11:40:32 2004
From: javascript at mattbarton.org (Matt Barton)
Date: Mon, 19 Jan 2004 17:40:32 -0000
Subject: [Javascript] Using the popup object in IE
Message-ID: <20040119174027.mattski@plus.net>
Paul and Peter,
Rats. I was hoping that that wouldn't happen ;)
I imagine I have some problem with some of my code that gets used as the
content of the popup - the snippets I gave you were only paraphrasing the
problem.
I'm going to prune my code right back (starting tomorrow - I've been
looking at the whole thing for nine hours already today...) and start from
basics.
Thanks for the help guys - at least I know that when I am trying to do is
possible... I was starting to wory that I couldn't use popup objects the
way I wanted to.
Matt
>Matt,
>
>FYI, your second code snippet *DID* work for me when I enclosed it in
html
>& body tags, running on IE 6.0.26.
>
>Paul
>
From trojani2000 at hotmail.com Mon Jan 19 18:56:35 2004
From: trojani2000 at hotmail.com (BEKIM BACAJ)
Date: Tue, 20 Jan 2004 01:56:35 +0100
Subject: [Javascript] Hi
Message-ID:
Bill, don't try that again!
>From: bill.marriott at optusnet.com.au
>Reply-To: "[JavaScript List]"
>To: Javascript at LaTech.edu
>Subject: [Javascript] Hi
>Date: Mon, 19 Jan 2004 15:35:51 +1000
>
> Test =)
>fgdulhrqngdhi
>--
>Test, yep.
><< liwopfc.exe >>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
From javascript at mattbarton.org Tue Jan 20 05:25:44 2004
From: javascript at mattbarton.org (Matt Barton)
Date: Tue, 20 Jan 2004 11:25:44 -0000
Subject: [Javascript] Transparent popup objects
Message-ID: <005501c3df48$250108d0$6199a8c0@selima.co.uk>
Hi,
Does anyone know if it is possible to make popup windows created with the createPopup method transparent (so that the original browser window is visible underneath, that is).
I have used the css property filter:alpha(opacity=10); but all I have managed to do is make elements within the popup transparent, while the actual window itself remains entirely opaque.
Thanks
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From javascript at mattbarton.org Tue Jan 20 05:34:51 2004
From: javascript at mattbarton.org (Matt Barton)
Date: Tue, 20 Jan 2004 11:34:51 -0000
Subject: [Javascript] Transparent popup objects
References:
Message-ID: <00a501c3df49$6b7d5b50$6199a8c0@selima.co.uk>
Hi,
Sorry, I should have explained: I want the popup window to span across
multiple frames, which is why I am using the createPopup method.
Matt
----- Original Message -----
From: Kodro
To: javascript at mattbarton.org
Sent: Tuesday, January 20, 2004 11:34 AM
Subject: RE: [Javascript] Transparent popup objects
Hi!
What about try to simulate a popup window with a DIV (position: absolute)?
Regards,
Kodro!
http://www.madrigaldelavera.net
-----Original Message-----
From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu]On
Behalf Of Matt Barton
Sent: Tuesday, January 20, 2004 12:26 PM
To: javascript at LaTech.edu
Subject: [Javascript] Transparent popup objects
Hi,
Does anyone know if it is possible to make popup windows created with the
createPopup method transparent (so that the original browser window is
visible underneath, that is).
I have used the css property filter:alpha(opacity=10); but all I have
managed to do is make elements within the popup transparent, while the
actual window itself remains entirely opaque.
Thanks
Matt
From dagda1 at hotmail.com Tue Jan 20 06:02:02 2004
From: dagda1 at hotmail.com (Paul Cowan)
Date: Tue, 20 Jan 2004 12:02:02 +0000
Subject: [Javascript] Function declaration
Message-ID:
Hi all,
Could anyone explain this function to me:
function TreeView1::oncontextmenu(){
//implementation
}
It is the TreeView1:: before the function name that is something that I have
never seen before.
Thanks
Paul
_________________________________________________________________
Express yourself with cool emoticons - download MSN Messenger today!
http://www.msn.co.uk/messenger
From spindrift at oceanfree.net Tue Jan 20 06:13:25 2004
From: spindrift at oceanfree.net (Tim Makins)
Date: Tue, 20 Jan 2004 12:13:25 -0000
Subject: [Javascript] Change Font Size
References:
Message-ID: <002301c3df4e$e5e77420$21e9fea9@abitic7g>
I noticed a very useful accessibility feature that some may find useful:
http://www.4duk.com/
and look at the very bottom of the page for 'Change font size'
The source of http://www.4duk.com/scripts/styleswitcher.js provides links
and further details.
Tim in Ireland.
From javascript at mattbarton.org Tue Jan 20 06:25:01 2004
From: javascript at mattbarton.org (Matt Barton)
Date: Tue, 20 Jan 2004 12:25:01 -0000
Subject: [Javascript] Function declaration
References:
Message-ID: <00cc01c3df50$6d090030$6199a8c0@selima.co.uk>
Hi,
I've never seen that used before in Javascript, but have done in PHP (and I
would expect the same syntax would be used in similar languages), but only
for calling a function, never for declaring a function.
If I had to hazard a guess I'd say that the example you've supplied was
attemping to define the oncontextmenu function of the TreeView1 object.
I suppose it would be similar to having:
Yada, yada, yada
I've no idea if that is actually what the code you've supplied is doing, and
all of the above is untested - I'm just thinking on my feet.
HTH
Matt
----- Original Message -----
From: "Paul Cowan"
To:
Sent: Tuesday, January 20, 2004 12:02 PM
Subject: [Javascript] Function declaration
> Hi all,
>
> Could anyone explain this function to me:
>
>
> function TreeView1::oncontextmenu(){
> //implementation
> }
>
> It is the TreeView1:: before the function name that is something that I
have
> never seen before.
>
> Thanks
>
> Paul
>
> _________________________________________________________________
> Express yourself with cool emoticons - download MSN Messenger today!
> http://www.msn.co.uk/messenger
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
> --
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net
From hakan at backbase.com Tue Jan 20 07:12:32 2004
From: hakan at backbase.com (Hakan M.)
Date: Tue, 20 Jan 2004 14:12:32 +0100
Subject: [Javascript] Function declaration
In-Reply-To: <00cc01c3df50$6d090030$6199a8c0@selima.co.uk>
References:
<00cc01c3df50$6d090030$6199a8c0@selima.co.uk>
Message-ID: <400D2940.9080609@backbase.com>
A search on prefixing a function with [variable/indentifier]:: returned
absolutely nothing for me, but Matt's assumption seem right.
Try this (pseudo)code to see if it works:
//---------------------
var oDiv = document.createElement('div');
oDiv.innerHTML = 'try clicking me';
function oDiv::onmousedown() {
alert('mousedown!');
}
document.body.appendChild(oDiv);
//---------------------
My guess is:
function oDiv*::onmousedown**
*) oDiv is the object where you want to add a method/define a method
**) The method you wish to add/modify
But again I have to agree with Matt, I have never ever seen this syntax
in JavaScript before (I've been developing complex javascript
applications for the last couple of years) but as soon as someone find
time to check the ECMAScript specs they will probably prove me wrong and
give me a cone hat to wear in the n00b-corner.
In conclusion I'd like to say, on a personal note, that if the code is
actually doing the exact same thing as in the example Matt provided, I
see no reason to use yet another confusing way of doing this. But I
guess it all comes down to preferred coding practice. :)
Regards,
Hakan
Matt Barton wrote:
> Hi,
>
> I've never seen that used before in Javascript, but have done in PHP (and I
> would expect the same syntax would be used in similar languages), but only
> for calling a function, never for declaring a function.
>
> If I had to hazard a guess I'd say that the example you've supplied was
> attemping to define the oncontextmenu function of the TreeView1 object.
>
> I suppose it would be similar to having:
>
> Yada, yada, yada
>
>
> I've no idea if that is actually what the code you've supplied is doing, and
> all of the above is untested - I'm just thinking on my feet.
>
> HTH
>
> Matt
>
> ----- Original Message -----
> From: "Paul Cowan"
> To:
> Sent: Tuesday, January 20, 2004 12:02 PM
> Subject: [Javascript] Function declaration
>
>
>
>>Hi all,
>>
>>Could anyone explain this function to me:
>>
>>
>>function TreeView1::oncontextmenu(){
>> //implementation
>>}
>>
>>It is the TreeView1:: before the function name that is something that I
>
> have
>
>>never seen before.
>>
>>Thanks
>>
>>Paul
>>
>>_________________________________________________________________
>>Express yourself with cool emoticons - download MSN Messenger today!
>>http://www.msn.co.uk/messenger
>>
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>--
>>This email has been verified as Virus free
>>Virus Protection and more available at http://www.plus.net
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
> .
>
From java.script at seacrets.com Tue Jan 20 08:13:19 2004
From: java.script at seacrets.com (Cutter (JavaScript List))
Date: Tue, 20 Jan 2004 09:13:19 -0500
Subject: [Javascript] Form validation
Message-ID: <400D377F.8070408@seacrets.com>
I am writing a form validation script whereby:
1) I create an array of field names
2) I pass this array and the form (this.form) to the valCheck function
3) I loop through each item in the array and evaluate the field to
determine if it is a select or not
4) I check to see if a value has been entered/selected
5) If no value then I alert the user they must enter a value before
they continue
What I want to do next is where it goes awry. I want to focus() on the
field that still needs information. I have tried this in a number of ways.
form.array[i].focus();
form.sName.focus(); // sName is a string equivelant of the array item
I have even tried passing the form name instead of the form object.
formName.array[i].focus();
form[formName].array[i].focus();
formName.sName.focus();
form[formName].sName.focus();
What am I doing wrong here?
Cutter
From christ at saeweb.com Tue Jan 20 08:26:56 2004
From: christ at saeweb.com (Chris Tifer)
Date: Tue, 20 Jan 2004 09:26:56 -0500
Subject: [Javascript] Form validation
References: <400D377F.8070408@seacrets.com>
Message-ID: <01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl>
> form.array[i].focus();
--------------------------
As long as it's an input of some sort, you can always do:
form.elements[array[i]].focus()
Now I'm assuming array[i] just refers to to a string. Not to an actual
element. If it's an element, it'd probably error out.
And I am also assuming that you did not name your array, array[]. Correct?
If so, call it something like arrFields or something else.
From java.script at seacrets.com Tue Jan 20 08:41:43 2004
From: java.script at seacrets.com (Cutter (JavaScript List))
Date: Tue, 20 Jan 2004 09:41:43 -0500
Subject: [Javascript] Form validation
In-Reply-To: <01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl>
References: <400D377F.8070408@seacrets.com>
<01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl>
Message-ID: <400D3E27.5000902@seacrets.com>
Chris,
Thanks, but I'm still languishing here. I tried
form.elements[arrFields[i]].focus();
and
form.elements[sName].focus();
Both times it gave me the error "Error:'elements' is null or not an
object". Any ideas? Anyone? Anyone?
Cutter
Chris Tifer wrote:
>>form.array[i].focus();
>>
>>
>--------------------------
>As long as it's an input of some sort, you can always do:
>
>form.elements[array[i]].focus()
>
>Now I'm assuming array[i] just refers to to a string. Not to an actual
>element. If it's an element, it'd probably error out.
>
>And I am also assuming that you did not name your array, array[]. Correct?
>If so, call it something like arrFields or something else.
>
>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
From javascript at mattbarton.org Tue Jan 20 08:46:26 2004
From: javascript at mattbarton.org (Matt Barton)
Date: Tue, 20 Jan 2004 14:46:26 -0000
Subject: [Javascript] Form validation
References: <400D377F.8070408@seacrets.com><01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl><400D3E27.5000902@seacrets.com>
<01d201c3df64$68256270$df0110ac@saweb.lcl>
Message-ID: <01e201c3df64$2e5c4b30$6199a8c0@selima.co.uk>
That's exactly what I was about to say.
> show us your exact code and I bet we can solve
> it.
From christ at saeweb.com Tue Jan 20 08:48:03 2004
From: christ at saeweb.com (Chris Tifer)
Date: Tue, 20 Jan 2004 09:48:03 -0500
Subject: [Javascript] Form validation
References: <400D377F.8070408@seacrets.com><01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl>
<400D3E27.5000902@seacrets.com>
Message-ID: <01d201c3df64$68256270$df0110ac@saweb.lcl>
First, what is "form"?
If that's the exact syntax you're using, I'd have to suggest that form is
not pointing to a form. If you have a name on your form (for instance
"myForm"), do this:
var objForm = document.forms["myForm"]
Then try
objForm.elements[arrFields[i]].focus()
form by itself is nothing...
If that still doesn't work, show us your exact code and I bet we can solve
it.
Chris Tifer
----- Original Message -----
From: "Cutter (JavaScript List)"
To: "[JavaScript List]"
Sent: Tuesday, January 20, 2004 9:41 AM
Subject: Re: [Javascript] Form validation
> Chris,
>
> Thanks, but I'm still languishing here. I tried
>
> form.elements[arrFields[i]].focus();
> and
> form.elements[sName].focus();
>
> Both times it gave me the error "Error:'elements' is null or not an
> object". Any ideas? Anyone? Anyone?
>
> Cutter
>
> Chris Tifer wrote:
>
> >>form.array[i].focus();
> >>
> >>
> >--------------------------
> >As long as it's an input of some sort, you can always do:
> >
> >form.elements[array[i]].focus()
> >
> >Now I'm assuming array[i] just refers to to a string. Not to an actual
> >element. If it's an element, it'd probably error out.
> >
> >And I am also assuming that you did not name your array, array[].
Correct?
> >If so, call it something like arrFields or something else.
> >
> >
> >
> >_______________________________________________
> >Javascript mailing list
> >Javascript at LaTech.edu
> >https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> >
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
From java.script at seacrets.com Tue Jan 20 08:53:14 2004
From: java.script at seacrets.com (Cutter (JavaScript List))
Date: Tue, 20 Jan 2004 09:53:14 -0500
Subject: [Javascript] Form validation
In-Reply-To: <01d201c3df64$68256270$df0110ac@saweb.lcl>
References: <400D377F.8070408@seacrets.com><01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl> <400D3E27.5000902@seacrets.com>
<01d201c3df64$68256270$df0110ac@saweb.lcl>
Message-ID: <400D40DA.1060903@seacrets.com>
In the document with the form I call my external script with the function:
script language="JavaScript" src="../js/valForm.js" type="text/javascript"
In the same document I create my array:
fields = new
Array('firstname','lastname','email','userlogin','password','verifypw','addr1','city','state','zip','phoneevn');
In the onSubmit of the form I call the function:
onSubmit="return valForm(fields,this.form)"
And the function (in the external file) looks like this:
function valForm(arrFields,form)
{
re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/; // email
validation regex
for (i = 0;i < arrFields.length; i++)
{
fieldName = form + '.' + arrFields[i];
sName = '' + arrFields[i] + ''; // trying this now since
arrFields[i] didn't work in elements[]
if ( fieldName.options )
val = fieldName.options(fieldName.selectedIndex).value;
else
val = fieldName.value;
if ( val == null || val == 0 )
{
alert('You forgot the following required information:\n' +
arrFields[i] + '');
form.elements[sName].focus();
return false;
}
if ( array[i] == 'email' )
{
if( !re.test(val) )
{
alert('You must provide a valid e-mail address.');
form.elements[sName].focus();
form.elements[sName].select();
return false;
}
}
return true;
}
}
And that's it for now. Just can't get this working yet...
Cutter
Chris Tifer wrote:
>First, what is "form"?
>
>If that's the exact syntax you're using, I'd have to suggest that form is
>not pointing to a form. If you have a name on your form (for instance
>"myForm"), do this:
>
>var objForm = document.forms["myForm"]
>
>Then try
>
>objForm.elements[arrFields[i]].focus()
>
>form by itself is nothing...
>
>If that still doesn't work, show us your exact code and I bet we can solve
>it.
>
>Chris Tifer
>
>----- Original Message -----
>From: "Cutter (JavaScript List)"
>To: "[JavaScript List]"
>Sent: Tuesday, January 20, 2004 9:41 AM
>Subject: Re: [Javascript] Form validation
>
>
>
>
>>Chris,
>>
>>Thanks, but I'm still languishing here. I tried
>>
>>form.elements[arrFields[i]].focus();
>>and
>>form.elements[sName].focus();
>>
>>Both times it gave me the error "Error:'elements' is null or not an
>>object". Any ideas? Anyone? Anyone?
>>
>>Cutter
>>
>>Chris Tifer wrote:
>>
>>
>>
>>>>form.array[i].focus();
>>>>
>>>>
>>>>
>>>>
>>>--------------------------
>>>As long as it's an input of some sort, you can always do:
>>>
>>>form.elements[array[i]].focus()
>>>
>>>Now I'm assuming array[i] just refers to to a string. Not to an actual
>>>element. If it's an element, it'd probably error out.
>>>
>>>And I am also assuming that you did not name your array, array[].
>>>
>>>
>Correct?
>
>
>>>If so, call it something like arrFields or something else.
>>>
>>>
>>>
>>>_______________________________________________
>>>Javascript mailing list
>>>Javascript at LaTech.edu
>>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>>
>>>
>>>
>>>
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
From javascript at mattbarton.org Tue Jan 20 08:56:57 2004
From: javascript at mattbarton.org (Matt Barton)
Date: Tue, 20 Jan 2004 14:56:57 -0000
Subject: [Javascript] Form validation
References: <400D377F.8070408@seacrets.com><01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl> <400D3E27.5000902@seacrets.com><01d201c3df64$68256270$df0110ac@saweb.lcl>
<400D40DA.1060903@seacrets.com>
Message-ID: <01ee01c3df65$a6af1990$6199a8c0@selima.co.uk>
I think that your problem might be down to your use of 'form' as a variable
name, as Chris suggested.
Instead of:
function valForm(arrFields,form)
as your function definition, try:
function valForm (arrFields, frmMyForm)
Then, in your function you might invoke a focus event on an element thus:
frmMyForm.elements[arrFields[i]].focus();
Try it and see what you get.
Matt
----- Original Message -----
From: "Cutter (JavaScript List)"
To: "[JavaScript List]"
Sent: Tuesday, January 20, 2004 2:53 PM
Subject: Re: [Javascript] Form validation
> In the document with the form I call my external script with the function:
>
> script language="JavaScript" src="../js/valForm.js" type="text/javascript"
>
> In the same document I create my array:
>
> fields = new
>
Array('firstname','lastname','email','userlogin','password','verifypw','addr
1','city','state','zip','phoneevn');
>
> In the onSubmit of the form I call the function:
>
> onSubmit="return valForm(fields,this.form)"
>
> And the function (in the external file) looks like this:
>
> function valForm(arrFields,form)
> {
> re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/; // email
> validation regex
>
> for (i = 0;i < arrFields.length; i++)
> {
>
> fieldName = form + '.' + arrFields[i];
> sName = '' + arrFields[i] + ''; // trying this now since
> arrFields[i] didn't work in elements[]
>
> if ( fieldName.options )
> val = fieldName.options(fieldName.selectedIndex).value;
> else
> val = fieldName.value;
>
> if ( val == null || val == 0 )
> {
>
> alert('You forgot the following required information:\n' +
> arrFields[i] + '');
> form.elements[sName].focus();
> return false;
>
> }
>
> if ( array[i] == 'email' )
> {
>
> if( !re.test(val) )
> {
>
> alert('You must provide a valid e-mail address.');
> form.elements[sName].focus();
> form.elements[sName].select();
> return false;
>
> }
>
> }
>
> return true;
>
> }
>
> }
>
> And that's it for now. Just can't get this working yet...
>
> Cutter
>
> Chris Tifer wrote:
>
> >First, what is "form"?
> >
> >If that's the exact syntax you're using, I'd have to suggest that form is
> >not pointing to a form. If you have a name on your form (for instance
> >"myForm"), do this:
> >
> >var objForm = document.forms["myForm"]
> >
> >Then try
> >
> >objForm.elements[arrFields[i]].focus()
> >
> >form by itself is nothing...
> >
> >If that still doesn't work, show us your exact code and I bet we can
solve
> >it.
> >
> >Chris Tifer
> >
> >----- Original Message -----
> >From: "Cutter (JavaScript List)"
> >To: "[JavaScript List]"
> >Sent: Tuesday, January 20, 2004 9:41 AM
> >Subject: Re: [Javascript] Form validation
> >
> >
> >
> >
> >>Chris,
> >>
> >>Thanks, but I'm still languishing here. I tried
> >>
> >>form.elements[arrFields[i]].focus();
> >>and
> >>form.elements[sName].focus();
> >>
> >>Both times it gave me the error "Error:'elements' is null or not an
> >>object". Any ideas? Anyone? Anyone?
> >>
> >>Cutter
> >>
> >>Chris Tifer wrote:
> >>
> >>
> >>
> >>>>form.array[i].focus();
> >>>>
> >>>>
> >>>>
> >>>>
> >>>--------------------------
> >>>As long as it's an input of some sort, you can always do:
> >>>
> >>>form.elements[array[i]].focus()
> >>>
> >>>Now I'm assuming array[i] just refers to to a string. Not to an actual
> >>>element. If it's an element, it'd probably error out.
> >>>
> >>>And I am also assuming that you did not name your array, array[].
> >>>
> >>>
> >Correct?
> >
> >
> >>>If so, call it something like arrFields or something else.
> >>>
> >>>
> >>>
> >>>_______________________________________________
> >>>Javascript mailing list
> >>>Javascript at LaTech.edu
> >>>https://lists.LaTech.edu/mailman/listinfo/javascript
> >>>
> >>>
> >>>
> >>>
> >>_______________________________________________
> >>Javascript mailing list
> >>Javascript at LaTech.edu
> >>https://lists.LaTech.edu/mailman/listinfo/javascript
> >>
> >>
> >
> >_______________________________________________
> >Javascript mailing list
> >Javascript at LaTech.edu
> >https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> >
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
> --
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net
From christ at saeweb.com Tue Jan 20 09:11:46 2004
From: christ at saeweb.com (Chris Tifer)
Date: Tue, 20 Jan 2004 10:11:46 -0500
Subject: [Javascript] Form validation
References: <400D377F.8070408@seacrets.com><01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl> <400D3E27.5000902@seacrets.com><01d201c3df64$68256270$df0110ac@saweb.lcl>
<400D40DA.1060903@seacrets.com>
Message-ID: <01f801c3df67$b8884630$df0110ac@saweb.lcl>
> fieldName = form + '.' + arrFields[i];
That's probably your problem. You're building a string here. Not a
reference to an element.
I wouldn't use "form" as a variable name either. I would use something else
as it either is a keyword or one day may become one.
> sName = '' + arrFields[i] + '';
And this piece here... arrFields[i] is already a string. No need to add the
" around it.
One thing I'd like to point out though. Why are you building a list of field
names, or is this just the fields you want validated, omitting a few others?
If you want ALL fields in a form, you can do something like:
function valForm(strFormName){
var objForm = document.forms[strFormName]
for(var x = 0; x < objForm.elements.length; x++){
var objEl = objForm.elements[x].name
// you have a handle on the current element now and if you
// add new elements they will automatically be included.
}
}
Hope that gives you some more hints on how to tackle this.
Perhaps the first thing you should do is rename the 2nd parameter in your
function to something like "objForm" or "myForm" and see how that helps.
Chris Tifer
From christ at saeweb.com Tue Jan 20 10:18:53 2004
From: christ at saeweb.com (Chris Tifer)
Date: Tue, 20 Jan 2004 11:18:53 -0500
Subject: [Javascript] Form validation
References: <400D377F.8070408@seacrets.com><01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl> <400D3E27.5000902@seacrets.com><01d201c3df64$68256270$df0110ac@saweb.lcl><400D40DA.1060903@seacrets.com>
<003d01c3df78$def2ceb0$2c041cac@PROCERGS.REDERS>
Message-ID: <023d01c3df71$190c97a0$df0110ac@saweb.lcl>
This is going off-topic, but for some reason I just hate eval(). I don't
believe I've ever found a need to use it. There's always some other way...
Chris Tifer
----- Original Message -----
From: "allard schripsema"
To: "[JavaScript List]"
Sent: Tuesday, January 20, 2004 12:14 PM
Subject: Re: [Javascript] Form validation
> here is your version working:
> The main problem was that you were working with a string, not an object.
> Here i used "eval" to get the object, but you could also use
> getElementById(sName)
>
>
>
>
> Untitled
>
>
>
>
>
>
>
> ----- Original Message -----
> From: "Cutter (JavaScript List)"
> To: "[JavaScript List]"
> Sent: Tuesday, January 20, 2004 11:53 AM
> Subject: Re: [Javascript] Form validation
>
>
> > In the document with the form I call my external script with the
function:
> >
> > script language="JavaScript" src="../js/valForm.js"
type="text/javascript"
> >
> > In the same document I create my array:
> >
> > fields = new
> >
>
Array('firstname','lastname','email','userlogin','password','verifypw','addr
> 1','city','state','zip','phoneevn');
> >
> > In the onSubmit of the form I call the function:
> >
> > onSubmit="return valForm(fields,this.form)"
> >
> > And the function (in the external file) looks like this:
> >
> > function valForm(arrFields,form)
> > {
> > re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/; // email
> > validation regex
> >
> > for (i = 0;i < arrFields.length; i++)
> > {
> >
> > fieldName = form + '.' + arrFields[i];
> > sName = '' + arrFields[i] + ''; // trying this now since
> > arrFields[i] didn't work in elements[]
> >
> > if ( fieldName.options )
> > val = fieldName.options(fieldName.selectedIndex).value;
> > else
> > val = fieldName.value;
> >
> > if ( val == null || val == 0 )
> > {
> >
> > alert('You forgot the following required information:\n' +
> > arrFields[i] + '');
> > form.elements[sName].focus();
> > return false;
> >
> > }
> >
> > if ( array[i] == 'email' )
> > {
> >
> > if( !re.test(val) )
> > {
> >
> > alert('You must provide a valid e-mail address.');
> > form.elements[sName].focus();
> > form.elements[sName].select();
> > return false;
> >
> > }
> >
> > }
> >
> > return true;
> >
> > }
> >
> > }
> >
> > And that's it for now. Just can't get this working yet...
> >
> > Cutter
> >
> > Chris Tifer wrote:
> >
> > >First, what is "form"?
> > >
> > >If that's the exact syntax you're using, I'd have to suggest that form
is
> > >not pointing to a form. If you have a name on your form (for instance
> > >"myForm"), do this:
> > >
> > >var objForm = document.forms["myForm"]
> > >
> > >Then try
> > >
> > >objForm.elements[arrFields[i]].focus()
> > >
> > >form by itself is nothing...
> > >
> > >If that still doesn't work, show us your exact code and I bet we can
> solve
> > >it.
> > >
> > >Chris Tifer
> > >
> > >----- Original Message -----
> > >From: "Cutter (JavaScript List)"
> > >To: "[JavaScript List]"
> > >Sent: Tuesday, January 20, 2004 9:41 AM
> > >Subject: Re: [Javascript] Form validation
> > >
> > >
> > >
> > >
> > >>Chris,
> > >>
> > >>Thanks, but I'm still languishing here. I tried
> > >>
> > >>form.elements[arrFields[i]].focus();
> > >>and
> > >>form.elements[sName].focus();
> > >>
> > >>Both times it gave me the error "Error:'elements' is null or not an
> > >>object". Any ideas? Anyone? Anyone?
> > >>
> > >>Cutter
> > >>
> > >>Chris Tifer wrote:
> > >>
> > >>
> > >>
> > >>>>form.array[i].focus();
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>--------------------------
> > >>>As long as it's an input of some sort, you can always do:
> > >>>
> > >>>form.elements[array[i]].focus()
> > >>>
> > >>>Now I'm assuming array[i] just refers to to a string. Not to an
actual
> > >>>element. If it's an element, it'd probably error out.
> > >>>
> > >>>And I am also assuming that you did not name your array, array[].
> > >>>
> > >>>
> > >Correct?
> > >
> > >
> > >>>If so, call it something like arrFields or something else.
> > >>>
> > >>>
> > >>>
> > >>>_______________________________________________
> > >>>Javascript mailing list
> > >>>Javascript at LaTech.edu
> > >>>https://lists.LaTech.edu/mailman/listinfo/javascript
> > >>>
> > >>>
> > >>>
> > >>>
> > >>_______________________________________________
> > >>Javascript mailing list
> > >>Javascript at LaTech.edu
> > >>https://lists.LaTech.edu/mailman/listinfo/javascript
> > >>
> > >>
> > >
> > >_______________________________________________
> > >Javascript mailing list
> > >Javascript at LaTech.edu
> > >https://lists.LaTech.edu/mailman/listinfo/javascript
> > >
> > >
> >
> >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> >
> >
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
From javascript at evermore.com Tue Jan 20 10:45:31 2004
From: javascript at evermore.com (Andrew Crawford)
Date: Tue, 20 Jan 2004 09:45:31 -0700
Subject: [Javascript] Change Font Size
In-Reply-To: <002301c3df4e$e5e77420$21e9fea9@abitic7g>
References:
Message-ID: <5.2.0.9.2.20040120093732.01cd2930@192.168.42.84>
Why bother with something like that? Modern browsers have a built-in font
size control that works just fine. In Mozilla, click view->text zoom and
choose different sizes. In IE, it is view->text size.
The style-sheet switcher is an interesting thought and might have some
other use. It didn't work for me in Mozilla 1.5 for XP the first time I
loaded the page, though. It wasn't until it had been sitting for a few
minutes that it functioned as I had originally expected.
Andrew Crawford
At 12:13 PM 1/20/2004 +0000, Tim wrote:
>I noticed a very useful accessibility feature that some may find useful:
>
>http://www.4duk.com/
>
>and look at the very bottom of the page for 'Change font size'
>
>
>The source of http://www.4duk.com/scripts/styleswitcher.js provides links
>and further details.
>
>Tim in Ireland.
From peter at brunone.com Tue Jan 20 10:48:49 2004
From: peter at brunone.com (Peter Brunone)
Date: Tue, 20 Jan 2004 09:48:49 -0700
Subject: [Javascript] Good vs. Eval (was Form validation)
Message-ID: <20040120164912.BCB3E308930@LaTech.edu>
No problem; just start a new thread!
What if you want to run a function based on a string?
-Peter B.
Original Message:
>From: "Chris Tifer"
>This is going off-topic, but for some reason I just hate eval(). I don't
>believe I've ever found a need to use it. There's always some other way...
>
>Chris Tifer
From christ at saeweb.com Tue Jan 20 10:54:12 2004
From: christ at saeweb.com (Chris Tifer)
Date: Tue, 20 Jan 2004 11:54:12 -0500
Subject: [Javascript] Good vs. Eval (was Form validation)
References: <20040120164912.BCB3E308930@LaTech.edu>
Message-ID: <000b01c3df76$0795d220$df0110ac@saweb.lcl>
I don't understand what you mean. Do you mean call a function dynamically?
I can't think of a good reason to do that, but I guess it could be needed in
some scenario. To me, this goes back to "There's always some other way..."
:)
Chris Tifer
----- Original Message -----
From: "Peter Brunone"
To:
Sent: Tuesday, January 20, 2004 11:48 AM
Subject: [Javascript] Good vs. Eval (was Form validation)
>
> No problem; just start a new thread!
>
> What if you want to run a function based on a string?
>
> -Peter B.
>
> Original Message:
> >From: "Chris Tifer"
>
> >This is going off-topic, but for some reason I just hate eval(). I don't
> >believe I've ever found a need to use it. There's always some other
way...
> >
> >Chris Tifer
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
From javascript at mattbarton.org Tue Jan 20 10:57:14 2004
From: javascript at mattbarton.org (Matt Barton)
Date: Tue, 20 Jan 2004 16:57:14 -0000
Subject: [Javascript] Good vs. Eval (was Form validation)
References: <20040120164912.BCB3E308930@LaTech.edu>
<000b01c3df76$0795d220$df0110ac@saweb.lcl>
Message-ID: <022701c3df76$749124b0$6199a8c0@selima.co.uk>
I'm inclined to agree. I've never had cause to do that (call a function
based on contents of a string variable) in Javascript, but exactly the same
thing is possible in PHP. In my darker moments I have been known to us it,
but I've never liked to. It's normally the result of a bad code design
descision I have made in the past which I've neither the time or inclination
to resolve.
Just as evil is $$variablename. But that's not just another thread, it's
another mailing list...
Matt
----- Original Message -----
From: "Chris Tifer"
>
> To me, this goes back to "There's always some other way..."
>
> :)
>
> Chris Tifer
From allard-schripsema at procergs.rs.gov.br Tue Jan 20 11:14:31 2004
From: allard-schripsema at procergs.rs.gov.br (allard schripsema)
Date: Tue, 20 Jan 2004 14:14:31 -0300
Subject: [Javascript] Form validation
References: <400D377F.8070408@seacrets.com><01ac01c3df61$74cf4bb0$df0110ac@saweb.lcl> <400D3E27.5000902@seacrets.com><01d201c3df64$68256270$df0110ac@saweb.lcl>
<400D40DA.1060903@seacrets.com>
Message-ID: <003d01c3df78$def2ceb0$2c041cac@PROCERGS.REDERS>
here is your version working:
The main problem was that you were working with a string, not an object.
Here i used "eval" to get the object, but you could also use
getElementById(sName)
Untitled
|