SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
-
Jul 16, 2002, 10:38 #1
- Join Date
- Sep 2000
- Location
- Chicago
- Posts
- 526
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Adding onBlur to dynamic textfield
Hey,
Ok so I am creating an element with:
PHP Code:var newElement = document.createElement('INPUT');
PHP Code:with (newElement)
{
name = "adjustmentCost" + count;
size = 7;
maxlength = 8;
onblur = "alert();"; //This doesn't seem to work
}
PHP Code:document.getElementsByName("ELEMENTNAME").onblur = "javascript:alert();";
Thanks,
Brett
-
Jul 16, 2002, 11:12 #2
- Join Date
- Jun 2002
- Location
- .chicago.il.us
- Posts
- 957
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:with (newElement) { name = "adjustmentCost" + count; size = 7; maxlength = 8; onblur = new Function("alert('Foo!');"); }
----Adopt-a-Sig----
Your message here!
-
Jul 17, 2002, 00:29 #3
- Join Date
- Feb 2002
- Location
- Gatwick, UK
- Posts
- 1,206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
normally you have to open a reference handle location for
an event handler, unless you're calling an existing function,
without parameters - in which case you can probably do it with:
object.onblur = callFunc
Notice the lack of ();
Flawless---=| If you're going to buy a pet - get a Shetland Giraffe |=---
-
Jul 17, 2002, 06:34 #4
- Join Date
- Sep 2000
- Location
- Chicago
- Posts
- 526
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ah, but I am trying to call an existing function with one parameter which is normally looks like this:
onblur='checkFloat(this)' - when placed in the input type='text' element. How should I do this?
Brett
-
Jul 17, 2002, 06:42 #5
- Join Date
- Feb 2002
- Location
- Gatwick, UK
- Posts
- 1,206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
randem's answer is right for you then.
you need to initiate a new memory space for the function.
Flawless---=| If you're going to buy a pet - get a Shetland Giraffe |=---
-
Jul 17, 2002, 06:46 #6
- Join Date
- Sep 2000
- Location
- Chicago
- Posts
- 526
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
So I need to rewrite the function in one line?
Brett
-
Jul 17, 2002, 06:46 #7
- Join Date
- Sep 2000
- Location
- Chicago
- Posts
- 526
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
rrrr, nm.. I see.. Thank you!..
-
Jul 22, 2002, 01:26 #8
- Join Date
- Feb 2002
- Location
- Gatwick, UK
- Posts
- 1,206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Clarity with time!
Flawless---=| If you're going to buy a pet - get a Shetland Giraffe |=---
Bookmarks