Solved

Disable Hyperlink

Posted on 2002-07-03
9
1,779 Views
Last Modified: 2012-05-04
trying to do something like this:

document.frmTemplateEdit.insertHeader.disabled = true;

After a person clicks on a hyperlink, I insert some text into a textarea and then I don't want that hyperlink to be pressed again.
0
Comment
Question by:lorena2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 10

Accepted Solution

by:
zvonko earned 50 total points
ID: 7127881
Simplest solution would be this:
<html>
<body>
<a href=# onClick="document.all.mytext.value='One tuch';this.onclick='' ">Only Once</a>
<br>
<textarea name=mytext>
Some Text
</textarea>
</body>
<html>

Is this what you want?

0
 

Author Comment

by:lorena2
ID: 7127891
BRAVO!  Thanks!
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7127952
Thank you for the points :)
0
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 
LVL 1

Expert Comment

by:vijayneema
ID: 7195417
Hi, Zvonko...


Can you tell me how to set the onClick back again.....

I will give you points if you can answer :)


-vijayneema
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7195521
Hello vijayneema,

I can answer :)
<html>
<body>
<a href=# name=FlipFlop onClick="document.all.mytext.value='FlipFlop1';this.onclick='' ">FlipFlop</a>
<br>
<input type=button value=Enable onclick="document.all.FlipFlop.onclick=function click(){document.all.mytext.value='FlipFlop2';this.onclick=''} ">
<br>
<textarea name=mytext>
Some Text
</textarea>
</body>
<html>

<|:-)

0
 

Author Comment

by:lorena2
ID: 7195699
function updateFieldList(strAction,strField,hlink_name)
{
     var strFields = document.frmFormName.field_list.value;
     if(hlink_name.innerText=='Exclude') //exclude from list
     {
          re = new RegExp(strField, 'gi')
          strFields = strFields.replace(re,'');
          document.frmFormName.field_list.value=strFields;    
          hlink_name.removeAttribute("onclick");
          hlink_name.setAttribute("onClick","updateFieldList('ADD','" + strField + "',this);");
          hlink_name.innerText = 'Include';
     }
     else{
          if(strFields==null || strFields==''){
               strFields = strField;
          }
          else{
               strFields = strFields + ',' + strField;
          }
          document.frmFormName.field_list.value=strFields;    
         
          hlink_name.removeAttribute("onclick");
          hlink_name.setAttribute("onClick","updateFieldList('EXCL','" + strField + "',this);");
          hlink_name.innerText = 'Exclude';
         
     }
}
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7196016
This is real ExpertsExchange :)

<html>
<head>
<script>
function updateFieldList(hlink_name)
{
    document.frmFormName.field_list.value=document.frmFormName.field_list.value.replace(/,Exclude/gi,'');
    if(hlink_name.innerText=='Exclude') //exclude from list
    {
         hlink_name.setAttribute("onClick","updateFieldList(this);");
         hlink_name.innerText = 'Include';
    }
    else{
         hlink_name.setAttribute("onClick","updateFieldList(this);");
         hlink_name.innerText = 'Exclude';
         document.frmFormName.field_list.value+=',Exclude';
    }
}
</script>
</head>
<body>
<form name=frmFormName>
<a href=# onClick="updateFieldList(this);">FlipFlop</a>
<textarea name=field_list></textarea>
</form>
</body>
</html>


Thank you lorena :)
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7196024
After uploading I saw a shorter version :)

<html>
<head>
<script>
function updateFieldList(hlink_name)
{
    document.frmFormName.field_list.value=document.frmFormName.field_list.value.replace(/,Exclude/gi,'');
    if(hlink_name.innerText=='Exclude') hlink_name.innerText = 'Include'; else{
         hlink_name.innerText = 'Exclude';
         document.frmFormName.field_list.value+=',Exclude';
    }
}
</script>
</head>
<body>
<form name=frmFormName>
<a href=# onClick="updateFieldList(this);">FlipFlop</a>
<textarea name=field_list></textarea>
</form>
</body>
</html>

<|:-)

0
 
LVL 1

Expert Comment

by:vijayneema
ID: 7200321
Hi,

thanks for your comments, but it still not solved my problem. I have posted a new question, please reply there:

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=javascript&qid=20332841


-vijayneema
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question