Jump to content

[SOLVED] Is java script right?


dare87

Recommended Posts

I want to place a text box on a webpage so that you can place information in the box and then when you hit submit it will forward you to

www.domainl.com/TEXTBOXINFO

 

Is Javascript the best way to do that.

 

Also I want to "hide" the url so that it doesn't look like the path has changed. I think that would be done in htaccess. I've been looking online and I can only find a iframe solution and I don't want that.

 

Thanks for the help

Link to comment
Share on other sites

You can't hide the URL that way. Each URL still has to be unique even if you re-write them, and since you are already on one page and want to go to another one, you will need to also change the URL.

 

A possible way around this is to use AJAX to load the page you want to go to inside the page you are in.

 

As for what you are asking, javascript is the only way you can do it.

Link to comment
Share on other sites

I wouldn't say it is the ONLY way to do it, but Javascript is the easiest and fastest option.

 

I have not heard of using .htaccess to hide the URL of the current page. The only way I can think of is by using frames, or as haku suggested, AJAX.

 

However, there is a better solution if you are able to use some server-side scripts: submit the text box in a form to the same page using method="post". Using your server-side script, access the file TEXTBOXINFO and print it out on the same page! There you have it, no visible change in the URL and content from the specified file!

Link to comment
Share on other sites

This is how I did it

 

<form action="" method="get" onsubmit="this.action = '../' + this.elements['code'].value.toLowerCase() + '/'; return true;">
<input type="text" class="required" name="code" id="code" size="15">
<input type="submit" value="Go">
</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.