?
Solved

Disable Hyperlink

Posted on 2002-07-03
9
Medium Priority
?
1,783 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 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…
Suggested Courses

840 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