I’m having some diffculty in getting some code to work.
Basically, what I’ve attempted to do is to make a hyperlink appear, and when it’s clicked it should call a script that hides the label(of the link) and replaces it with the acutal URL. But the problem I keep having is the link label keeps trying to access a URL instead of the onclick event.
I’ll show the code, as maybe it will explain this a little better.
[Code]
function doEmailLink(suffix)
{
var rtn = true;
if(showObject(’emailVal’+suffix)) {
rtn = false;
hideObject(’emailLink’+suffix);
showObject(’emailLabel’+suffix);
}
return rtn;
}
function getObject(objID)
{
if (document.all)
{
var obj = document.all[objID];
}
else if (document.getElementById)
{
var obj = document.getElementById(objID);
}
return obj;
}
function hideObject(objID)
{
var obj = getObject(objID);
var rtn = false;
if (obj != null) {
obj.style.display = “none”;
rtn = true;
}
return rtn;
}
function showObject(objID)
{
var obj = getObject(objID);
var rtn = false;
if (obj != null) {
obj.style.display = “inline”;
obj.style.position = “static”;
obj.style.width = “auto”;
obj.style.height = “auto”;
obj.style.overflow = “visible”;
rtn = true;
}
return rtn;
}
<span class=”hidden” ID=”emailVal0″><br>Email: <a href=”mailto:[email protected]”>email</a></span>
<span ID=”emailLink0″><a title=”Show Email” onClick=”return doEmailLink(‘0’);” href=””>email</a></span>
<span style=”display: none;” ID=”emailLabel0″>email</span>
So those are the functions I’m using…basically, in this example of code I want it to just give me a hyperlink that says “Email” and when I click on it it replaces it with the actual URL, instead of it trying to open a new webpage. Can it be done this way? I’m a novice, but I really need to get this to work.
Thanks,
D