Understanding a Javascript Function
I don't really know anything about Javascript and I am trying to understand thi开发者_运维知识库s piece of code:
<a href="javascript:void(0);" onClick='toggle_detail(this, "value-computations", "3")' ">
The part I don't understand relates to the portion that indicates onClick='toggle_detail..
Is this a custom function or a native Javascript function?
Ultimately I am looking to re-write this anchor tag so that on click it displays <div class="details">
and on the second click it hides the content of <div class="details">
.
All help is greatly appreciated, as I know nothing about Javascript.
toggle_detail is a custom function. It should be defined somewhere else on the page, or in a script that the page links to. Here's a good reference/tutorial on javascript.
You're correct. It's a custom function. It has been defined elsewhere, either in a < script >
tag that actually shows code, or it's been referenced in a < script >
tag that has a src
attribute.
Toggle detail is a custom function.
A well written toggle_detail function wouldn't require you to change the anchor tag at all. Usually, a function that called toggle would flip a setting back and forth, like visibility of another element
精彩评论