Forum Moderators: open

Message Too Old, No Replies

Creating a url from a form text field

         

pixi

11:54 am on Nov 19, 2011 (gmt 0)

10+ Year Member



hi,

i use this form to create url's and open the url by clicking at a search button.

Only the created url should open in a new Window. But when i use window.open also the parent window with the form loads the new url.

Have someone an ideas?



<script>
function converturl() {
document.go.url.value = document.go.url.value.replace( /\s/g, "_");
var url = document.getElementsByName( "url")[0];
var fullurl = document.getElementsByName( "fullurl")[0];
fullurl.value = "http://www.domain.com/"+ url.value +".html";
//window.open(fullurl.value);
}
</script>


<body>
Websuche: <form name= "go" onsubmit='converturl();location.href=fullurl.value;return false'>
<input name='url' type='text' /> <input name='fullurl' type='hidden' />
<input type='submit' value="search" />
</code>
</body>

daveVk

12:59 pm on Nov 19, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<form name= "go" onsubmit='converturl();location.href=fullurl.value;return false'>

Removing red bit ?

pixi

3:45 pm on Nov 19, 2011 (gmt 0)

10+ Year Member



Thank you very much Dave, that works.