js小示例1

1.动态操作<a>的url
<a id="RegUrl" style="COLOR:#ff3333">注册新用户?</a>

<script>        
    GetRegReturnUrl();
    
function GetRegReturnUrl()
    {                        
        url 
="http://www.sina.com/mysina/userreg.aspx?nexturl="+window.location;
        if(document.getElementById('RegUrl')!=null)
        {
            document.getElementById('RegUrl').href 
= url;
        }
    }
</script>
2.取select当前选中值的方法。
var p = document.getElementById('selectID');
alert(p.options[p.options.selectedIndex].value);
posted @ 2005-09-09 09:30  烈马狂生  阅读(231)  评论(0)    收藏  举报