/    Sign up×
Community /Pin to ProfileBookmark

Launch click event of a hidden link

I am trying to get the click event to launch a hidden link but it is not working in FF, yet it works in IE7.
Basically what Im doing here is clicking a link that is located in an iframe, that onclick event passes the ID of the record to the funtion below and sets the href attribute with that ID.

The hidden link then launches a colorbox(lightbox clone) popup with the record details.

Does FF use somethig different?

This is my javascript function:

[CODE]
function clickHiddenLnk(id)
{
document.getElementById(“lnkHidden”).setAttribute(“href”, page.aspx?ID=” + id);
document.getElementById(“lnkHidden”).click();
}[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Pbear74authorSep 10.2009 — nevermind.

answer:

<i>
</i>if ($get("buttonName").dispatchEvent){
var e = document.createEvent("MouseEvents");
e.initEvent("click", true, true);

$get("buttonName").dispatchEvent(e);
}
else{
$get("buttonName").click();
}
×

Success!

Help @Pbear74 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...