You need to sign in to do that
Don't have an account?
Java Script Not working in OutputLink
HI ,
I am using one output link in which if you click that link that should hide and new link should appear in the same . If you click the new link again that should hide and the old one should appear vice - vesa . I am giving the sample code below .
<apex:outputLink id="map2" value="javascript:hidemap();" styleClass="hideMapLink">
<span>{!$Label.Hide_Map}</span>
</apex:outputLink>
<apex:outputLink id="map1" value="javascript:showmap();resizeMap();" styleClass="showMapLink">
<span>{!$Label.Show_Map}</span>
</apex:outputLink>
<script language="javascript">
function showmap()
{
document.getElementById("mapContainer").style.display="block";
}
function hidemap()
{
document.getElementById("mapContainer").style.display="none";
}
</script>
<div id="mapContainer" class="mapclass" style="display:none">
<div id="map" >
</div>
</div>
Initially ShowMap link will Appear . If you click that link one block appear with map loaded in it , and Showmap link has to change to HideMap. And if you clikc HideMap link mapblock should close and showmap link should appear .
Now the issue is i am able to open Mapblock but the link was not changing to HideMap . Please help me how to acheive this.
Many Many thanks in Advance .
yeah... Its workng . .. Write the outputlink in div tag and use the Id of that div in the viewmap () function instead outputlink Id
All Answers
you don't appear to be performing any action which would cause your desired affect to happen. you could add a "Rendered" param to the outputlinks and apply a condition, or you could just use the style.display function that you're already using to make them visible/invisible. Something like
No .. Its not working . B'Coz
document.getElementById("map2").style.display="inline"; will use only for div tags means , the ID "map2" is not a div id in our case .
It should work, you might need to get the full path Id. Try using firebug or IE's built in JS debugger to find the element's full id. for example, it might be page:pageBlock:map1
yeah... Its workng . .. Write the outputlink in div tag and use the Id of that div in the viewmap () function instead outputlink Id
Cool, glad it's working. As I say, it would have worked if you used the full Id of the outputlink too