Html - Ub3r
<div class="IPBDescription">lil qn bout forms</div> i made a little form validation
typing:
/d yeast
will give you the defination for yeast
/a CBF
will look up teh acronym for 'cbf'
/i frisbee
this will look up google for frisbee pictures
/ip
this gives your ip according to a url..
if it is just plain words it will look up those words on google...
heres the code : :
--------------------------------------
<script language="JavaScript">
<!-- //
function GoToURL() {
var URLis = document.searchform.query.value
if (URLis.substring(0,2) == "/d") {
var location = ("http://dictionary.reference.com/search?q=" + URLis.substring(3, URLis.length));
this.location.href = location;
} else if (URLis.substring(0,2) == "/a") {
var location = ("http://www.acronymfinder.com/af-query.asp?p=dict&String=exact&Acronym=" + URLis.substring(3, URLis.length));
this.location.href = location;
} else if (URLis.substring(0,3) == "/ip") {
var location = ("http://checkip.dyndns.org/");
this.location.href = location;
} else if (URLis.substring(0,2) == "/i") {
var location = ("http://images.google.com/images?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&q=" + URLis.substring(3, URLis.length));
this.location.href = location;
} else {
var location = ("http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=" + URLis.substring(0, URLis.length));
this.location.href = location;
}
}
// -->
</script>
<center>
/d phenomenon - Defination
/a ROFL - Acronym finder
/i Catus - Google image search
default submit = google search
/ip - ip check
<form name="searchform" onsubmit="return false;">
<input type=text name="query" size="50">
<input type=submit value="seek" OnClick="GoToURL(this)">
</form>
--------------------------------
my problem is.. i cant get it to work when i press enter.. it always depends on an external onclick etc event...
if you can press enter it'll be full sweet..
any help appreciated..
typing:
/d yeast
will give you the defination for yeast
/a CBF
will look up teh acronym for 'cbf'
/i frisbee
this will look up google for frisbee pictures
/ip
this gives your ip according to a url..
if it is just plain words it will look up those words on google...
heres the code : :
--------------------------------------
<script language="JavaScript">
<!-- //
function GoToURL() {
var URLis = document.searchform.query.value
if (URLis.substring(0,2) == "/d") {
var location = ("http://dictionary.reference.com/search?q=" + URLis.substring(3, URLis.length));
this.location.href = location;
} else if (URLis.substring(0,2) == "/a") {
var location = ("http://www.acronymfinder.com/af-query.asp?p=dict&String=exact&Acronym=" + URLis.substring(3, URLis.length));
this.location.href = location;
} else if (URLis.substring(0,3) == "/ip") {
var location = ("http://checkip.dyndns.org/");
this.location.href = location;
} else if (URLis.substring(0,2) == "/i") {
var location = ("http://images.google.com/images?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&q=" + URLis.substring(3, URLis.length));
this.location.href = location;
} else {
var location = ("http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=" + URLis.substring(0, URLis.length));
this.location.href = location;
}
}
// -->
</script>
<center>
/d phenomenon - Defination
/a ROFL - Acronym finder
/i Catus - Google image search
default submit = google search
/ip - ip check
<form name="searchform" onsubmit="return false;">
<input type=text name="query" size="50">
<input type=submit value="seek" OnClick="GoToURL(this)">
</form>
--------------------------------
my problem is.. i cant get it to work when i press enter.. it always depends on an external onclick etc event...
if you can press enter it'll be full sweet..
any help appreciated..
Comments
<a href='http://hapz.tk' target='_blank'>http://hapz.tk</a>
wen u type teh same stuff and double click the input field it will work... thats the problem.. i want it to work wen i press enter..
^^
awaiting input
here modified code in case ya wanna know wot was teh problem
<script language="JavaScript">
<!-- //
function GoToURL() {
var URLis = document.searchform.query.value
if (URLis.substring(0,2) == "/d") {
var location = ("http://dictionary.reference.com/search?q=" + URLis.substring(3, URLis.length));
this.location.href = location;
return false;
}
}
// -->
</script>
<form name="searchform" onsubmit="return GoToURL(this);">
<input type=text name="query" size="50">
<input type=submit value="seek" OnClick="GoToURL(this)">
</form>
------------------------------
to see this working goto
<a href='http://hapz.tk' target='_blank'>http://hapz.tk</a>
type /i = for google images
/ip = ipaddress
/d = dictionary
/t = thesaurus
/a = acronym finder
But i can say that that is truly one purdy website <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo--> Nice work indeed.
ND