Access value of HTML title attribute as variable in onclick function
I want to access the value of the HTML title attribute as a variable for
the onclick function.
This is an example for my HTML elements:
<a title="id:4" onclick="openWin(4)">example</a>
This is my JavaScript function:
function openWin(number)
{
window.open("http://www.some-example.org/some/example/id:"+number)
}
This works but since I have a lot of HTML elements, I'd like to find a way
to reference the title value inside the openWin() function instead of
writing "openWin(someNumber)". Do you have any ideas how to do this?
Any help would be much appreciated!
No comments:
Post a Comment