|
Hello ppl, im new to dhtml and so far i've only done tooltips and gradients.
What im trying to do this time is have a textbox that will change a string variable when checked, which will be used in a link, something like this:
when checked:
<a href="index.php?show=list&item=a&subitem=b">
when unchecked:
<a href="/forum/index_show_list_ampitem_a.html">
for several reasons, i cannot use the POST method with this, and i need the link for the item to change depending on wether the user wants the sub item or not.
any help is highly apreciated.
|
|
|
so far i got this:
<SCRIPT>
function SetLink()
{
document.all.MyLink.innerText = '<a href="www.altavista.com">Altavista</a>'
}
</SCRIPT>
<INPUT TYPE=checkbox CHECKED ID=chk1 onclick="SetLink()">This is a checkbox.
<span id="MyLink"><a href="www.google.com">Google</a></span>
but it outputs the link as text instead of an actual link.
|
|
|
nm , i got it
<SCRIPT>
function SetLink()
{
if(document.all.chk1.checked==1){
document.all.MyLink.innerHTML = "<a href='www.altavista.com'>Altavista</a>"
}else{
document.all.MyLink.innerHTML = "<a href='www.google.com'>Google</a>"
}
}
</SCRIPT>
<INPUT TYPE=checkbox CHECKED ID=chk1 onclick="SetLink()">Uncheck
blah.
<span id="MyLink"></span>
DHTML is pretty cool, i hope i can learn all its tricks, ty anyway!
|
|
|
|
|
|
|
|