Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有人知道为什么href不是';t在Internet Explorer中启动JavaScript?_Javascript_Html_Internet Explorer 11 - Fatal编程技术网

有人知道为什么href不是';t在Internet Explorer中启动JavaScript?

有人知道为什么href不是';t在Internet Explorer中启动JavaScript?,javascript,html,internet-explorer-11,Javascript,Html,Internet Explorer 11,有人能告诉我为什么这个href不会在IE11中启动JavaScript吗?它适用于所有其他浏览器 <a href="<%# "javascript:checkSelection('UserSImageSelectionByCategory.aspx?PartialPath=" + base64Encode((string)DataBinder.Eval(Container.DataItem,"PartialPath")) +

有人能告诉我为什么这个href不会在IE11中启动JavaScript吗?它适用于所有其他浏览器

<a href="<%# "javascript:checkSelection('UserSImageSelectionByCategory.aspx?PartialPath=" 
               + base64Encode((string)DataBinder.Eval(Container.DataItem,"PartialPath")) +
               "&var=" + variableName + "', " 
               +DataBinder.Eval(Container.DataItem, "Height" )+ ", "
                +DataBinder.Eval(Container.DataItem, "Width" )+")" %>"
             >

您应该使用onclick属性来调用任何javascript函数。Href用于指向其他页面的超链接

<a href="#" onclick="<%# "javascript:checkSelection('UserSImageSelectionByCategory.aspx?PartialPath=" 
               + base64Encode((string)DataBinder.Eval(Container.DataItem,"PartialPath")) +
               "&var=" + variableName + "', " 
               +DataBinder.Eval(Container.DataItem, "Height" )+ ", "
                +DataBinder.Eval(Container.DataItem, "Width" )+")" %>"
             >


像往常一样尝试
,它是如何呈现的?当查看客户端问题时,查看服务器端代码是痛苦的。它在Edge中工作?当您在网页上“查看源代码”以查看生成的HTML时,有什么?控制台中有错误吗?onclick不起作用。我还没有在Edge中测试过它,今天我将尝试这样做。在开发控制台中没有抛出错误。问题是IE无论如何都不会接受javascript。使用代码时,它只会选择href并转到页面顶部。