C# 点击按钮时的javascript

C# 点击按钮时的javascript,c#,javascript,asp.net,input,C#,Javascript,Asp.net,Input,我有以下几点: <script> function SetContent(link) { document.getElementById('lowerContent').innerHTML = "<iframe frameborder='0' src='" + link + "' width=100%' height='" + (screen.height - 100) + "px'"; } </scrip

我有以下几点:

<script>
   function SetContent(link) {
            document.getElementById('lowerContent').innerHTML =
         "<iframe frameborder='0' src='" + link + "' width=100%' height='" + (screen.height - 100) + "px'";
        } 
</script>

函数设置内容(链接){
document.getElementById('lowerContent').innerHTML=

“试试这个。用onclick代替href

<a href="#" onclick="javascript:return SetContent('http://www.google.com');" title="URL">URL</a> 


试试这个。用onclick代替href

<a href="#" onclick="javascript:return SetContent('http://www.google.com');" title="URL">URL</a> 


将javascript分配给按钮单击的工作原理如下:

<input type="button" onclick="javascript:SetContent('http://urlhere);" value="Click me at your own risk!">


相应地调整属性(id等)。

将javascript分配给按钮单击的工作方式如下:

<input type="button" onclick="javascript:SetContent('http://urlhere);" value="Click me at your own risk!">
<input type="button" onclick="SetContent('http://urlhere');" />

相应地调整属性(id等)。


<input type="button" onclick="SetContent('http://urlhere');" />

在脚本中,您已将return设置为false。因此,它将返回true并调用回发。您不需要在href上添加javascript。您可以按如下方式添加onclick:

<input type="button" onclick="SetContent('http://urlhere');" />

<script>
    function SetContent(link) 
    {
        document.getElementById('lowerContent').innerHTML = "<iframe frameborder='0' src='" + link + "' width=100%' height='" + (screen.height - 100) + "px'";
        return false;
    } 
</script>

函数设置内容(链接)
{

document.getElementById('lowerContent').innerHTML=“在脚本中,您已将return设置为false。因此,它将返回true并调用回发。您不需要在href上添加javascript。您可以按如下方式添加onclick:

<input type="button" onclick="SetContent('http://urlhere');" />

<script>
    function SetContent(link) 
    {
        document.getElementById('lowerContent').innerHTML = "<iframe frameborder='0' src='" + link + "' width=100%' height='" + (screen.height - 100) + "px'";
        return false;
    } 
</script>

函数设置内容(链接)
{

document.getElementById('lowerContent').innerHTML=“就是这样。一个小问题,因为我在页面上有几个其他asp:按钮,当我在文本框中输入文本并点击enter时,激活了其他按钮,而不仅仅是上面的按钮。如何解决这个问题?我鼓励您提出另一个问题,提供相关的代码位(ASP和C#)。是的,就是这样。一个小问题,因为我有几个其他ASP:当我在文本框中输入文本并点击enter时,页面周围的按钮会激活其他按钮,而不仅仅是上面的按钮。如何解决这个问题?我鼓励你问另一个问题,提供相关的代码位(ASP和C#)。