i've got an <a> tag that opens a link in a new window... however i want it to be evident which <a> has been clicked on the previous page, so i'm looking for a way to set the text as bold when it the link is clicked.. i've tried onclick="this.style.font-weight: bold;" and onclick="this.text.bold()" but neither worked.. anyone know a way to do this?
sorry.. i didn't explain what i needed well enough. i have 2 windows, one of them contains links, the other opens the pages for the links.. what i wanted was for any link i open to turn bold, and all the rest of the links to go back to normal, the window with the links is never reloaded either.. so my solution was to use javascript to set the link as bold onclick and set the previously bold link as normal at the same time.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Links</title> <style type="text/css"> .active { font-weight: bold; } </style> </head> <body> <a href="page1.html" id="link1" onclick="changeActiveStates(this)">Link 1</a> <a href="page2.html" id="link2" onclick="changeActiveStates(this)">Link 2</a> <script type="text/javascript"> function byId(id) { return document.getElementById ? document.getElementById(id) : document.all[id]; } var prevLink = ""; function changeActiveStates(ele) { if (prevLink) byId(prevLink).className = ""; ele.className = 'active'; prevLink = ele.id; } </script> </body> </html> Code (markup):