?
Solved

Disable Hyperlink

Posted on 2002-07-03
9
Medium Priority
?
1,780 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 200 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…
Suggested Courses

770 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