Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Bidding Directory   ClickBooth Network   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 05-15-2006, 02:48 PM   #1 (permalink)
Contributing Member
 
ATLien's Avatar
 
Join Date: 10-13-03
Location: Atlanta, GA
Posts: 2,279
iTrader: 0 / 0%
Latest Blog:
Feed has moved

ATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really nice
Send a message via AIM to ATLien
Just a quick Javascript question

Code:
javascript:ajaxload('livesearch.php', 'rightcolumn');
ok, I use the line above to execute a javascript function. On the same page alittle earlier I have a search box with an id of query. How could I make it so when people type in the search box "v7n" it would change the above code to

Code:
javascript:ajaxload('livesearch.php?q=v7n', 'rightcolumn');
dynamically.

What this is a live search, that I am writing, and I want people to have a search box then a search button and when they click search, dynamically the page will change with out reloading.
__________________
ATLien is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 05-16-2006, 02:50 AM   #2 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,819
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
Do you want it to change as soon as thy finish typing v7n in the box? Or when they click the button?

The code you specified, is that in the button onclick attribute?
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-16-2006, 01:58 PM   #3 (permalink)
Contributing Member
 
ATLien's Avatar
 
Join Date: 10-13-03
Location: Atlanta, GA
Posts: 2,279
iTrader: 0 / 0%
Latest Blog:
Feed has moved

ATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really nice
Send a message via AIM to ATLien
I would like it to happen when they type, right now that is the onclick of the button.
__________________
ATLien is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-16-2006, 03:15 PM   #4 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,819
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
Post

Can't the ajaxload function check the search box to see if it has 'v7n' ?
Or (more likely) an intermediate function called by the button, that decides what url to pass to the ajaxload function?

Anyway, you can make a function to check the contents of the search box every time a letter is typed by attaching it to the onkeyup event. Not sure how cross-browser that event is, the onchange event could be used but some browsers don't fire that event until after the user 'clicks out' of the text-box (until the text-box loses focus). If you wait till after they have finished typing then you can use the onblur event, this one is made for when the text-box loses focus, and I think is the best time to check for the 'v7n' and most reliably cross-browser.

so search box attribute onblur="checkme(this)"

and a function to test the text etc
Code:
function checkme(element) { if (!element || !element.tagName || !element.tagName=='INPUT') return; // stop if not what we expected. var txt = ''+element.value; var button = document.getElementById('***insert your button id here***'); if ( txt.search('v7n') ) button.onclick = "ajaxload('livesearch.php?q=v7n', 'rightcolumn');"; else button.onclick = "ajaxload('livesearch.php?', 'rightcolumn');"; }
Note the button code is changed whether the v7n is found or not (incase they take the v7n away again!).

Also note the code is not tested at all, there may be mistakes!
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt

Last edited by LazyJim : 05-16-2006 at 03:22 PM.
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-16-2006, 03:30 PM   #5 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,819
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
There's also a text-input event: http://www.w3.org/TR/DOM-Level-3-Eve...vent-textInput

But I've never heard of it before so might not actually work any/many current browsers yet???
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick Question about SEO Big Mountain SEO Forum 24 02-25-2008 04:40 AM
Hi... quick question AaronC Computers & Internet 2 09-10-2007 08:08 PM
quick css question downtroden Coding Forum 2 02-04-2005 02:42 PM
Simple JavaScript question I, Brian Coding Forum 16 01-07-2005 11:27 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 09:50 PM.
© Copyright 2008 V7 Inc