<p><span class="lk" id="prf_g" onclick="document.location.href='http://www.csdn.net'">设置</span> </p>

解决方案 »

  1.   

    可以用这种方式<HTML>
    <BODY ONLOAD="setupEventHandler()" LANGUAGE="VBS">
    <SCRIPT LANGUAGE="VBS">
    function setupEventHandler()
    set fpchgBackground = getRef("chgBackground")
    call mySpan.attachEvent("onclick", fpChgBackground)
    end function
    function chgBackground()
    document.bgColor = "lemonchiffon"
    end function
    </SCRIPT>
    <SPAN ID="mySpan">SPAN</SPAN>
    </BODY>
    </HTML>
    这个是vbs,主要是就是利用object.attachEvent(sEvent, fpNotify)
    参考:
    bSuccess = object.attachEvent(sEvent, fpNotify)
    ParameterssEvent:   Required. String that specifies any of the standard DHTML Events. 
    fpNotify: Required. Pointer that specifies the function to call when sEvent fires. Return ValueBoolean. Returns one of the following possible values:true The function was bound successfully to the event. 
    false The function was not bound to the event. 
      

  2.   

    这些标记都经过JavaScript的初始化,所以可点击,例如:<p><span class="lk" id="prf_g">设置</span> </p><script type="text/javascript">
    var lkOptions=document.getElementById("prf_g");
    lkOptions.onclick=function(){
    document.location="www.x2blog.cn";
    }
    </script>
      

  3.   

    或者直接用dom规则取到span这个对象
    对象.onclick=function gonext()
    {
       document.location.href="http://www.csdn.net"
    }
      

  4.   

    <p><span class="lk" id="prf_g">设置</span> </p><script>
    //文档加载完成后组prf_g绑定一个事件。
    window.onload = function(){
      document.getElementById("prf_g").onclick = function (){
        location.href = "xxx.asp";
      }}
    </scriopt>
      

  5.   

    <p><span class="lk" id="prf_g" onclick="window.location.href='http://www.baidu.com'">设置1</span></p>
      

  6.   

    <p><span class="lk" id="prf_g">设置2</span></p>
    <script>
       var sp = document.getElementById("prf_g");
       sp.onclick=function(){
         window.location.href = "http://www.baidu.com";
       }
    </script>
      

  7.   

    <p><span class="lk" id="prf_g" onclick="window.location.href='http://www.baidu.com'">设置1</span></p>
    用上面的方法,在一个frame中,我要指向另外一个框架怎么做呢
      

  8.   

    <p><span class="lk" id="prf_g" onclick="window.framename.location.href='http://www.baidu.com'">设置1</span></p>
      

  9.   

    如果两个框架同层的话:
    <p><span class="lk" id="prf_g" onclick="self.parent.framename.location.href='http://www.baidu.com'">设置1</span></p>
      

  10.   

    onclick="top.location.href='url';"
    为什么不直接用<a href="url">url</a>