codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  textboxes and strings  HinDRAncE at 17:00 on Tuesday, January 30, 2007
 

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.

  Re: textboxes and strings  HinDRAncE at 18:26 on Tuesday, January 30, 2007
 

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.

  Re: textboxes and strings  HinDRAncE at 18:43 on Tuesday, January 30, 2007
 

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!








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  array copy
•  byte swapping in Perl
•  close window
•  Passing Variable To js File
•  Re: Compiling JAVA code in .NET?
•  managed nd unmanaged code..
•  Looking for free form submit php script?
•  horizontal scroll of images
•  Re: DHTML : popup slider using image


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007