javascript split -
<script language="javascript"> function frompost() { var string=$('#indexsearch').val(); var url=string.split('='); if(url==""){ var url=string.split('video/'); } var finalurl='http://watchvideos.tv/watch/'+url[1]; window.location = finalurl; //$('#srchfrm').attr('action',finalurl); //document.srchfrm.submit(); } </script>
i have problem script - it's ok long indexsearch field contains =
, fails when it's supposed work - video/
in field
try this:
function frompost() { var str = $('#indexsearch').val(), url = str.split(/=|video\//), finalurl = 'http://watchvideos.tv/watch/'+url[1]; window.location = finalurl; }
Comments
Post a Comment