Solved

Disable Hyperlink

Posted on 2002-07-03
9
1,776 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
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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delay Form Submission without touching existing code? 5 24
jQuery delay animation 3 30
If condition on Html with Asp 11 18
Html CheckBox obtain Its Value 5 16
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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-…
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…

822 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