NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page JavaScript: Turn form submit into URL

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-15-2005, 02:57 PM THREAD STARTER               #1 (permalink)
New Member
Join Date: Mar 2005
Posts: 14
ZachH is an unknown quantity at this point
 



JavaScript: Turn form submit into URL


Hi Everybody

I have this site called Statbrain.com and I have a Javascript problem that I just can’t solve. It is a pretty annoying problem because it should be so simple. It might be simple, but I just can’t figure out how to solve it.

Let me explain.

I have this field where the users can put an URL into a form and click the submit button and the info for that site will be show. If you were checking www.yahoo.com the user would be forwarded to this page:
http://www.statbrain.com/result.php5...=www.yahoo.com
????: NamePros.com http://www.namepros.com/programming/90386-javascript-turn-form-submit-into-url.html

But that is not what I want. I want the user to be forwarded to:
http://www.statbrain.com/www.yahoo.com/

Both of the pages give the same result, but I want the second one for different reasons. Before you say this is a piece of cake let me tell you what I’ve tried so far.

First I tried to use OnClick and window.location and window.location.href. This worked ok, but only in IE it did not work in Firefox at all. It has to work in Firefox since 20% of my visitors use Firefox.

Then I tried to use OnClick and this.form.action. This did work in IE, but pressing enter to submit the for did not work.

Anyone who has a good and simple idea on how I can solve this?

Sorry about the long post, tried to do it as short as possible.

Regards,
__________________
Zach Highknee
www.statbrain.com
FREE Tells you how many visitors any website has.
ZachH is offline  
Old 05-15-2005, 03:29 PM   #2 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,809
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



i've pmed you
stscac is offline  
Old 05-15-2005, 04:57 PM THREAD STARTER               #3 (permalink)
New Member
Join Date: Mar 2005
Posts: 14
ZachH is an unknown quantity at this point
 



Someone in another forum found a solution:
<form action="" onsubmit="var loc='http://www.statbrain.com/'+this.elements[0].value+'/';location.href=loc;return false">

Works like a dream.

Thanks.
__________________
Zach Highknee
www.statbrain.com
FREE Tells you how many visitors any website has.
ZachH is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse a URL in PHP to return domain RJ Programming 43 11-12-2004 08:45 AM
Paypal Settlement CMachuca The Break Room 3 07-31-2004 11:14 PM
PAYPAL Litigation johnn Domain Name Discussion 6 07-31-2004 10:51 PM
Paypal Settlement Lord The Break Room 2 07-30-2004 10:30 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:38 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger