/ Published in: JavaScript
Expand |
Embed | Plain Text
function toggleText(id,text1,text2) { var DomObject = document.getElementById(id); DomObject.innerHTML = (DomObject.innerHTML == text1) ? text2 : text1; } <a href=""toggleText('Link_"&i&"','+','-');"" id=""Link_"&i&""">+</a>
Comments
Subscribe to comments
You need to login to post a comment.

i've been looking at a lot of different styles of link toggles. but this one is so compact and clean.
I'm not an expert level javascript programmer though...so would someone explain the two sets of quotes after the href= ...? don't we normally write javascript:toggleText() etc?
i've been looking at a lot of different styles of link toggles. but this one is so compact and clean.
I'm not an expert level javascript programmer though...so would someone explain the two sets of quotes after the href= ...? don't we normally write javascript:toggleText() etc?