Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show/hide hyperlink

Status
Not open for further replies.

1000kisoen

IS-IT--Management
Aug 12, 2004
37
NL
hi,
I have a field call TYPE.
each record have there own type for example
1> CCR
2> CIR
3> CPR

when opening a record (CCR) some links must shown
but when opening a record (CIR) these links must be hidden
as it not relevant for this record

how can I manage to show or hide some hyperlinks if the record have a particular TYPE.

Please advise
Kisoen
 
Set the links to have the CSS style [tt]display:none;[/tt]

Then from the [tt]<BODY>[/tt] tag's [tt]onload[/tt] event, call a function to interrogate the field and set the [tt]style.display[/tt] property of the appropriate links to "inline".

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
hi,
I ;am very new to javascript
could you please give a push?
how I can easyly manage this?

thx kisoen
 
Code:
<head>
<script>
function show_hide_links(){
// get the value of the type field
var objType = document.getElementById("fldType");
var strType = objType.value;
switch(strType){
 case "CCR" : {
  document.getElementById("CCRLink_1").style.display = "inline";
  document.getElementById("CCRLink_2").style.display = "inline";
  break;
 }
 case "CIR" : {
  document.getElementById("CIRLink_1").style.display = "inline";
  document.getElementById("CIRLink_2").style.display = "inline";
  break;
 }
 case "CCR" : {
  document.getElementById("CPRLink_1").style.display = "inline";
  document.getElementById("CPRLink_2").style.display = "inline";
  break;
 }
}
}
</script>
</head>
<body onload="show_hide_links()">
<input type="text" id="fldType" name="type" /><br/>
<a href="CCR_1.html" id="CCRLink_1">CCR Page 1</a><br/>
<a href="CCR_2.html" id="CCRLink_2">CCR Page 2</a><br/>
<a href="CIR_1.html" id="CIRLink_1">CIR Page 1</a><br/>
<a href="CIR_2.html" id="CIRLink_2">CIR Page 2</a><br/>
<a href="CPR_1.html" id="CPRLink_1">CPR Page 1</a><br/>
<a href="CPR_2.html" id="CPRLink_2">CPR Page 2</a><br/>
</body>
</html>

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top