ASP.NET小收集:分解Url

<html>
    
<head>
    
</head>
    
<body>
        
<form name='form1' action='' method='post'>
            
<input type='text' name='aa' id='aa'>
            
<input type='button' value='check' onclick='checkUrl()'>
        
</form>
        
<script type="text/javascript" language="javascript">
        
function checkUrl()
        {
            
var acurl=document.getElementById('aa').value;
            
var kk=location.href;
            alert(kk);
            
var k=acurl.lastIndexOf('/');
            alert(k);
            
var m=acurl.indexOf('-');
            alert(m);
            
var s1=acurl.substring(k,m);
            
var sbase=acurl.substring(0,m);
            alert(sbase
+s1+'---1--.htm');
        }
        
</script>
    
</body>
</html>
posted @ 2008-09-18 16:16  仲卿  阅读(270)  评论(0编辑  收藏  举报