文章详情页
如何使用变量里的方法
浏览:113日期:2024-06-01 09:00:49
问题描述
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ajax</title>
</head>
<body>
<button onclick="ass.ss()">执行</button>
<script>
var ass = function ss() { alert("hello") };
//求解如何可以执行到 ss() 方法
</script>
</body>
</html>
问题解答
回答1:直接使用变量名加括号来访问就行了。你的这个直接使用ass()来使用就行了
相关文章:
1. Python列表或者字典里面的中文如何处理?2. angular.js - AngularJS如何添加的DOM元素且能绑定事件3. php工具箱配置第二个vhost主机时不生效,报错You don’t have permission4. python 字符串匹配问题5. 在webstorm里配置nodejs,在配置Sources of Node.js Modules时为什么找不到路径6. 同一个html页面用多个id有什么影响?7. python - django里GROUP BY 如何写这样的mysql语句?8. css - 元素跟随鼠标轻微移动效果,求指教实现方法?9. javascript - ios返回不执行js怎么解决?10. css - The element has no supported sources.???
排行榜

网公网安备