jsam Posted September 10, 2006 Share Posted September 10, 2006 i'm getting input from people and taking them to a webpage, but the only way i know to do this is with window.open. i want to have the same functionality but instead of a new window, i want the page to load in the same window instead of openning a new one.an example would be:[code] function submital() { x = ""; x = document.ans.text.value; x = x.toLowerCase(); window.open(x + '.htm'); }[/code]this obviously opens a new page. i want the same functionality (i.e., be able to get info from my form and use that in the "submital" function), but without the new window.thanks for any help. Quote Link to comment Share on other sites More sharing options...
radalin Posted September 10, 2006 Share Posted September 10, 2006 window's open method was an overloaded one as I remember. You can define to open in a new window or not. There was something around in this forum.By the way you try document.location = x + ".htm" instead of window.open() Quote Link to comment Share on other sites More sharing options...
jsam Posted September 10, 2006 Author Share Posted September 10, 2006 i tried to use document.location (and document.location.href) and neither seems to do what i want it to (in fact, both just sit there). i'm still searching around the forum to find where they said how to use window.open and opt to not open a new window...any more help? Quote Link to comment Share on other sites More sharing options...
radalin Posted September 10, 2006 Share Posted September 10, 2006 Seems that I have mistaken about that. window.open will create a new window. Here is a quick search from google and what I have foundhttp://www.devguru.com/Technologies/ecmaScript/quickref/win_open.htmldo you try to redirect someone to a domain outside of yours then you should add http:// before. <script language="javascript">document.location = "http://www.google.com"; </script>works ok by the way. Quote Link to comment Share on other sites More sharing options...
jsam Posted September 10, 2006 Author Share Posted September 10, 2006 ok, so i know i'm pathetic at javascript...could you use the "google" example such that if a person entered "google" into the form and hit "submit," google would enter in the same window. i can't seem to get this to work for me, but i'm sure it's just my scripting shortcoming. Quote Link to comment Share on other sites More sharing options...
radalin Posted September 10, 2006 Share Posted September 10, 2006 [code]<form name="frm1"><input type="text" name="destination" id="destination" /><input type="button" value="Get me the link" onSubmit="document.location = 'http://www.' + destination.value + '.com' ;" /> </form>[/code]I assume that the user enters google on the textbox and not anything else like google.com or www.google.com Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.