javascript - Get link name and write it down in a div -
i want use name link clicked show in div. tried many things nothing comes out. have little script show , hide div worked fine until tried make script name. please take quick look.
//script hiding , display div function showdiv() { document.getelementbyid('popup').style.display = "block"; } function hidediv() { document.getelementbyid('popup').style.display = "none"; } and html:
<div class="maintab"> <div class="tab" onclick="showdiv()" ><a href="#">template</a></div> </div> <div id="bestelknop">**here name must come**</div> <div id="popup" style="display:none"> <ul> <a href="http://pixelweb.be" target="iframe" onclick="hidediv()" name="pixelweb">pixelweb</a> <a href="http://templates.pixelweb.be/social" target="iframe" onclick="hidediv()" name="social">social</a> <a href="http://templates.pixelweb.be" target="iframe" onclick="hidediv()" name="templates" >templates pixelweb</a> </ul> </div> now want display name van de current link in div bestelknop.
i'm newbee in javascript please me this.
regards,
benny
you can pass current link function.
take working example here: http://jsfiddle.net/xfw3p/
<div class="maintab"> <div class="tab" onclick="showdiv()" ><a href="#">template</a></div> </div> <div id="bestelknop">**here name must come**</div> <div id="popup" style="display:none"> <ul> <a href="http://pixelweb.be" target="iframe" onclick="hidediv(this)" name="pixelweb">pixelweb</a> <a href="http://templates.pixelweb.be/social" target="iframe" onclick="hidediv(this)" name="social">social</a> <a href="http://templates.pixelweb.be" target="iframe" onclick="hidediv(this)" name="templates" >templates pixelweb</a> </ul> </div> the javascript code:
function showdiv() { document.getelementbyid('popup').style.display = "block"; } function hidediv(link) { document.getelementbyid('popup').style.display = "none"; document.getelementbyid('bestelknop').innerhtml = link.name; }
Comments
Post a Comment