Anyone know how...
- Started
- Last post
- 14 Responses
- scarabin
to create a form that will take you here:
http://www.jupiterimages.com/Sea…
onsubmit, where "dog" is the value of a text input field?
i suspect this could be done with javascript somehow...
basically i'm trying to put a jupiterimages search field on a website, but they use some weird system i can't figure out so i'm trying to use a workaround based off of the url string their form outputs...
does that make any sense?
- airey0
isn't that a search function using a database?
- scarabin0
weird, it truncated my URL. this is what the last part of the URL looks like:
/Search/Image#dog
- scarabin0
i just can't figure out how to add a term like "dog" after a hashmark like that
- airey0
it may simply have the supporting script in the background not so much search anything but just list any item with that tag.
- scarabin0
this probably isn't making any sense. i'm trying to hack the search URL they use by creating a new form of my own
- airey0
if you work it out let us know though.
- bigtrickagain0
here:
<form id="searchform">
<input type="text" id="searchinput" />
</form>
(using jquery)
<script type="text/javascript">
$("#searchform").submit(function... {
document.location.href = "http://www.jupiterimages.com/Se... + $("#searchinput").val();
});
</script>
there.
- bigtrickagain0
wtf. the line that starts with $("#searchform") should end with "function() {"
and the line that starts with document.location should have "http://www.jupiterimages.com/Se... in the quotes.
- bigtrickagain0
fuck, my code keeps getting messed up by qbn. anyway, put the whole url in quotes in that line, ending with "/Search#" and it should work.
- scarabin0
amazing. lemme try that.
- bigtrickagain0
you gotta include jquery on your page, and flesh out the form with a submit button, too.
you can do it without jquery also but i can't be arsed to write it out. jquery is my crutch.
- scarabin0
think you can email me this? i wanna make sure i don't mess up the code...
thanks!
- donebigtrickagain
- thanks!scarabin
- i even tried it out to make sure it worked. now that's servicebigtrickagain
- you're famous for servicing young men bigtrickagain.airey
- scarabin0
so this is what i have
http://scarabin.net/homepage/tes…
and it doesn't seem to be working. am i doing something wrong?
- yes. you're a fucker. but that's a whole different thing.airey
- i wonder if its the way i'm including the jqueryscarabin
- airey is always good for moral supportbigtrickagain
- hahascarabin
- bigtrickagain0
oops - i forgot - the end of your script block should look like this:
return false;
});
</script>if you add that return false in there it will work fine.
it's also best if you host the jquery js on your own site (: