Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding "onblur" event to specific textbox. 1

Status
Not open for further replies.

Geee

Programmer
Apr 23, 2001
253
GB
Hi, I want to add an onblur event to a specific textbox. The textbox is created by a php class which is why I can't add the event into the html. I have the following:

Code:
document.getElementById('ink_colours_edit').onchange = showinks();

Where ink_colours_edit is the id of the textbox and showinks() is the javascript function I wish to be run. This doesn't seem to work.

Any ideas greatfully received!

Gary

-Geeeeeeeeeeeeeeeeeeeeeeee-
 
including the parentheses just calls the function. you are close. here's what you want:

Code:
document.getElementById('ink_colours_edit').onchange = showinks;



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Wow!

Quick and right - you must be a hit with the ladies ;).

Thanks so much.

-Geeeeeeeeeeeeeeeeeeeeeeee-
 
Wow!

Quick and right.

Thanks so much.

-Geeeeeeeeeeeeeeeeeeeeeeee-
 
ahhhh.... and remove the parens, good eye cory

have a long, thick, purple one on me

-kaht

[small]How spicy would you like your chang sauce? Oh man... I have no idea what's goin' on right now...[/small]
[banghead]
 
Grr the forum seems to be breaking when I try to post. Anyway, thanks to both, onblur was a typo in the title, I wanted to add an onchange event, and I'm calling it from window.onload. The question I wanted to now is, whats the difference between calling a function using the () or not using the ()?

Thanks
G

-Geeeeeeeeeeeeeeeeeeeeeeee-
 
kaht, how the hell did you become an IT guy? you crack me up!

thanks for the long, thick, purple ones guys.

and yes, Geeeeeeeeeeeeeeeeeee, I am quite the hit with the ladies... just ask...

eh, we'll keep it clean.



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
you never CALL a function without using (). in other words, you ALWAYS call a function USING the paren's. watch:

Code:
<script type="text/javascript"><!--

function doLongPurpleThing() {
    alert("thanks!");
}

// call the function
doLongPurpleThing();

// attach the function to an event so when the event actually
// happens, THEN it gets called
onload = doLongPurpleThing;

//-->
</script>



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Magic, I'm learning every day, thanks again.

-Geeeeeeeeeeeeeeeeeeeeeeee-
 
kaht, how the hell did you become an IT guy? you crack me up!

I got a nintendo when I was in 5th grade. When I went in for my advisor meeting to set up my High School classes I had always wanted to be a baseball player (not very realistic - I wasn't THAT good) My dad came with me and the advisor asked what I wanted to do. I didn't have an answer and so my dad said "you like to play video games, why don't you get into computers". And that was it.

I didn't really look or act like the typical IT guy in college either: I'm the one with the guitar

-kaht

[small]How spicy would you like your chang sauce? Oh man... I have no idea what's goin' on right now...[/small]
[banghead]
 
ex-friend, he got pretty weird my last semester of college. Rarely came out of his room, stopped talking to everybody. It's a shame too, I got along with him really well before that.

Oh, and he dated the girl taking the picture, so he probably did want to kill her.....

-kaht

[small]How spicy would you like your chang sauce? Oh man... I have no idea what's goin' on right now...[/small]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top