[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 05-15-2005, 01:57 PM   #1 (permalink)
New Member
 
Join Date: Mar 2005
Posts: 14
28.00 NP$ (Donate)

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

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, 02:29 PM   #2 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
 
Join Date: Aug 2004
Posts: 3,794
47.60 NP$ (Donate)

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, 03:57 PM   #3 (permalink)
New Member
 
Join Date: Mar 2005
Posts: 14
28.00 NP$ (Donate)

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

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
Parse a URL in PHP to return domain RJ Programming 43 11-12-2004 07:45 AM
Paypal Settlement CMachuca The Break Room 3 07-31-2004 10:14 PM
PAYPAL Litigation johnn Domain Name Discussion 6 07-31-2004 09:51 PM
Paypal Settlement Lord The Break Room 2 07-30-2004 09:30 PM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 01:00 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85