onclick转到url然后做一些特定的事情 [英] onclick go to url THEN do something specific

查看:92
本文介绍了onclick转到url然后做一些特定的事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一个页面(我们称之为list_page.html),其中包含js函数,可以单击链接并查看多媒体对象列表。单击另一个链接(在同一页面上)将隐藏带有多媒体列表的div并显示视频对象列表。另一个链接将隐藏任何列表可见并显示音频对象列表,依此类推...

i have a page on my site (let's call it list_page.html) with js functions that allow you to click a link and see a list of multimedia objects. clicking another link (on the same page) will hide the div with the multimedia list and reveal a list of video objects. another link will hide whatever list is visible and reveal a list of audio objects, and so on...

$("#multibtn").click(function(){
    $(".menuslab").hide();
    $(".menuslab > *").hide();
    $("#multi_div").fadeIn("slow");
    $("#multi_div > *").fadeIn("slow");
});

如果在我的主页面(mainpage.html)我有一个名为multimedia的链接,是否有一种方法,我可以让它导航到list_page.html并执行调用多媒体对象列表的函数?

if on my main page (mainpage.html) i have a link named "multimedia", is there a way i can get it to navigate to list_page.html AND execute the function that calls the list of multimedia objects?

推荐答案

最近方法可能是将一个查询字符串附加到URI,解析location.hash并查看它是否是某个值,如果是,则触发该点击。

Closest way perhaps would be to append a query string to the URI, parse location.hash and see if it's a certain value, and if so trigger that click.

这篇关于onclick转到url然后做一些特定的事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆