PDA

View Full Version : ایجاد فرم برای ارسال کاربر به یک صفحه خاص



dady123
سه شنبه 06 خرداد 1393, 23:06 عصر
با سلام


میخواستم یه فرم طراحی کنم که یه اسم از کاربر بگیره و مستقیم بره به صفحه اون اسم
مثلا کاربر در کادر وارد کنه علی بعد از ارسال کاربر یه صفحه example.com/علی منتقل بشه


با دستور get میشه ساخت ولی اون یه علامت ? را به آدرس میده که نمیخوام اون علامت باشه

مهدی اسماعیلی
چهارشنبه 07 خرداد 1393, 01:02 صبح
<script language="javascript">
function SendToUrl(){
//window.location= "http://www.mysite.com/" + document.getElementById('txt').value;
window.location= window.location.pathname + "/"+ document.getElementById('txt').value;
}
</script>
<input type="text" id="txt" />
<input type="button" value="ok" onClick="SendToUrl();" />

dady123
چهارشنبه 07 خرداد 1393, 11:54 صبح
<script language="javascript">
function SendToUrl(){
//window.location= "http://www.mysite.com/" + document.getElementById('txt').value;
window.location= window.location.pathname + "/"+ document.getElementById('txt').value;
}
</script>
<input type="text" id="txt" />
<input type="button" value="ok" onClick="SendToUrl();" />

خیلی ممنون