Html - Ub3r

haPihaPi Join Date: 2003-04-16 Member: 15556Members
<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..

Comments

  • haPihaPi Join Date: 2003-04-16 Member: 15556Members
    ok i implemented this onto my weblinks page

    <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
  • haPihaPi Join Date: 2003-04-16 Member: 15556Members
    ahh fixed.. thnx anyway

    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
  • DubbilexDubbilex Chump Join Date: 2002-11-24 Member: 9799Members
    Well...I know <i>less than</i> nothing about mapping (impossible? You decide)

    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.
  • RPG_JssmfulhudRPG_Jssmfulhud Join Date: 2002-11-02 Member: 4006Members
    That knife looks awesome! <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
  • GeminosityGeminosity :3 Join Date: 2003-09-08 Member: 20667Members
    yeah! the knife is cool! o.O
  • nightdragonnightdragon Join Date: 2003-01-05 Member: 11848Members, Constellation
    The knife is <!--emo&:0--><img src='http://www.unknownworlds.com/forums/html/emoticons/wow.gif' border='0' style='vertical-align:middle' alt='wow.gif'><!--endemo--> <!--emo&:0--><img src='http://www.unknownworlds.com/forums/html/emoticons/wow.gif' border='0' style='vertical-align:middle' alt='wow.gif'><!--endemo-->

    ND
Sign In or Register to comment.