Current location: Hot Scripts Forums » General Web Coding » JavaScript » Id specificless function


Id specificless function

Reply
  #1 (permalink)  
Old 11-23-09, 08:49 AM
protocode protocode is offline
Newbie Coder
 
Join Date: May 2009
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Id specificless function

I have 3 textboxes. Onkeyup, each individually initiates an ajax script for one autosuggestion box.
The problem, I have a script that fills in the value from the autosuggest box back into the textbox. The problem is my 'fill' script defines one textbox, the first one, and won't fill in the result in the textbox that I was typing in. Thanks in advance

Code:
<script type="text/javascript">
	function fill(thisValue) {
			$('#id1').val(thisValue);
			setTimeout("$('#suggestions').hide();", 200);
	}
</script>
HTML Code:
<form name="form" method="get" action="" />
<input name="id1" id="id1" value="E00" onkeyup="lookup(this.value);" onclick="fill();" maxlength="50" type="text" size="15" />
<input name="id2" id="id2" value="E00" onkeyup="lookup(this.value);" onblur="fill();" maxlength="50" type="text" size="15" />
<input name="id3" id="id3" value="E00" onkeyup="lookup(this.value);" onblur="fill();" maxlength="50" type="text" size="15" />

<div class="suggestionsBox" id="suggestions" style="display: none;">
		<div class="suggestionList" id="autoSuggestionsList"></div>
</div>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-23-09, 07:21 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
A little bit of modifying should be able to make this work.

Instead of using "lookup(this.value)", you could use just "lookup(this)", and then in the lookup() function use "this.id" to find which textbox to post back to. (You'd also have to use "this.value" to see what the value being passed in is.)
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[2005] StartPosition for CommonDialogs? tim8w Windows .NET Programming 10 01-08-09 04:39 AM
Parsing XML dodotopia PHP 1 02-08-06 04:51 PM
ASP upload prob minority ASP 1 06-27-05 09:35 AM
PHP Error Fairnie PHP 8 06-26-04 08:15 AM
Help trim code down TheLaughingBandit JavaScript 0 09-02-03 10:50 AM


All times are GMT -5. The time now is 07:16 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.