I am creating a dynamic menu using CSS pseudo elements, and an external js file.
My problem is creating an “onclick” event.
I am using the js file in order to keep my menu independent of individual pages, thus enabling me to effect any future edits site-wide. My initial attempt was:
document.write('<dt onclick="javascript:expand('smenu3');">MENUITEM</dt>');
in which the onclick event triggered the function written at the beginning of the JavaScript file.
Of course, when I use the HTML
<dt onclick="javascript:expand('smenu3');">MENUITEM</dt>
in each page, it works flawlessly but I am then once again stuck with all menu items listed within each and every page which is unacceptable.
I have also tried this:
Identifying ‘smenu3’ as follows:
document.write('<dd id="smenu3">');
and having the onclick command written at the beginning of the js file under the function ‘expand’
onclick=expand('smenu3');
I’m sure there is a work-around, I simply have been banging on the problem too long and can’t step back to see it.
Please help.
My problem is creating an “onclick” event.
I am using the js file in order to keep my menu independent of individual pages, thus enabling me to effect any future edits site-wide. My initial attempt was:
document.write('<dt onclick="javascript:expand('smenu3');">MENUITEM</dt>');
in which the onclick event triggered the function written at the beginning of the JavaScript file.
Of course, when I use the HTML
<dt onclick="javascript:expand('smenu3');">MENUITEM</dt>
in each page, it works flawlessly but I am then once again stuck with all menu items listed within each and every page which is unacceptable.
I have also tried this:
Identifying ‘smenu3’ as follows:
document.write('<dd id="smenu3">');
and having the onclick command written at the beginning of the js file under the function ‘expand’
onclick=expand('smenu3');
I’m sure there is a work-around, I simply have been banging on the problem too long and can’t step back to see it.
Please help.