Web Design and Development Forums

code help please

This is a discussion on "code help please" within the JavaScript Forum section. This forum, and the thread "code help please are both part of the Program Your Website category.

Old Apr 30th, 2008, 02:04   #1 (permalink)
Junior Member
 
Join Date: Mar 2008
Location: seattle.wa
Posts: 15
code help please

can't get this code to work, what it's supposed to do is run the first function and and it's parameters through the second function. The first function works fine, what it does is validates the text input to make sure it doesn't have something it's not supposed to have, then searches google with the word or phrase in the text input. The second function will allow the user to press enter while in the text input to search instead of clicking on the search button, but it is supposed to access the first function, but doesn't, I've done this with other functions before, for some reason, this search function doesn't work. please help me out. Thanks for any help.

Code: Select all
<html>
<head>
<title></title>
<script language="JavaScript">
function enable_it(search_id, search_text_id, search_text_stop){
if(document.getElementById(search_text_id).value != 'please enter search word(s)' && document.getElementById(search_text_id).value != ''){
document.getElementById(search_id).disabled =true
document.getElementById(search_text_stop).disabled =true
document.getElementById(search_id).value = 'searching...'
window.location = 'http://www.google.com/search?hl=en&q=' + document.getElementById(search_text_id).value
}
else{
document.getElementById(search_text_id).value = 'please enter search word(s)'
document.getElementById(search_text_id).style.color = 'red'
}
}

function press_it(e, search_id, search_text_id, search_text_stop){
var ieff = ''
if(window.event){
var ieff = e.keyCode
}
elseif(e.which){
var ieff = e.which
}
if(ieff =="13"){
enable_it(search_id, search_text_id, search_text_stop);
}
}
</script> 
</head>

<body>
<form>
<input type="text" id="search_text" value="please enter search word(s)" size="40" onFocus="this.value = ''; this.style.color='black'" onKeyPress="press_it(event, 'search', 'search_text', 'search_text')">
<input type="button" value="search" id="search" onClick="enable_it('search', 'search_text', 'search_text')">
</form>


</body>
</html>

lcsaeteurn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 30th, 2008, 02:06   #2 (permalink)
Junior Member
 
Join Date: Mar 2008
Location: seattle.wa
Posts: 15
Re: code help please

some of the spaces disapeared on the post: ie:
document.getElementById(search_id).disabled = true
lcsaeteurn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
code behind code doesnt work skat ASP.NET Forum 4 Feb 18th, 2008 10:05
live search code and styleswitcher code hebel JavaScript Forum 0 May 12th, 2007 06:16
Can anyone help me with this code? KOinMotion HTML Forum 3 Nov 14th, 2006 17:33
Can somebody give me the code to hide the source code? renren JavaScript Forum 7 Mar 7th, 2006 12:27
Code for "<" Underdog HTML Forum 33 Oct 4th, 2003 07:53



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 20:09.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59