Solved

Disable Hyperlink

Posted on 2002-07-03
9
1,773 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
  • 5
  • 2
  • 2
9 Comments
 
LVL 10

Accepted Solution

by:
zvonko earned 50 total points
Comment Utility
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
Comment Utility
BRAVO!  Thanks!
0
 
LVL 10

Expert Comment

by:zvonko
Comment Utility
Thank you for the points :)
0
 
LVL 1

Expert Comment

by:vijayneema
Comment Utility
Hi, Zvonko...


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

I will give you points if you can answer :)


-vijayneema
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 10

Expert Comment

by:zvonko
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now