JavaScript奇怪问题
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> Untitled Page </title>
<script type= "text/javascript ">
function select()
{
window.alert( "text ");
}
</script>
</head>
<body >
<form id= "form1 " runat= "server ">
<input type= "button " id= "button " value= "select a value " onclick= "select() " />
<input type= "button " id= "button2 " value= "select a value " onclick= "javascript:document.form1.text1.value=showModalDialog( 'Default3.aspx ',3) " /> <br/>
<input type= "text " id= "text1 " />
</form>
</body>
</html>
现在的问题是:
<input type= "button " id= "button " value= "select a value " onclick= "select() " /> 并没有弹出警告框!
<input type= "button " id= "button " value= "select a value " onclick= "javascript:alert( 'text ') " /> 却可以。
什么原因?
------解决方案--------------------不要用select来命名函数
select是属性
换个名