根据JavaScript中的URL参数模拟单击
-
15-11-2019 - |
题
我有一个附加到URL的参数。根据此参数的值,我需要模拟单击下拉框项。我试图使用所选索引并工作。但是,在使用所选索引时,它不像点击功能,我有一些功能,只有在下拉项上有一个单击时显示的功能。
URL是这样的:
http://www.mydomain.com/mypage.html?paramName=paramValue
.
有没有办法在JavaScript中我如何实现这一目标?我尝试了.click()事件,但无济于。
非常感谢
解决方案
Move the code out of the .click
event handler, and call this new function from both locations (click handler & on URL parsing).
不隶属于 StackOverflow