/    Sign up×
Community /Pin to ProfileBookmark

script to change color

I’m trying to use:

[CODE]
<script type=”text/javascript”>
<!–
window.onload=function(){
document.getElementById(‘text7’).onclick=function(){
this.style.color= ‘#CC0000’;
return false;
}
}
//–>
</script>
[/CODE]

to change the color of the links printed by:

[CODE]
<hx:outputLinkEx styleClass=”outputLinkEx” id=”formPdfLink”
onclick=”return openPDFWord(this, ‘#{varsearchResults.targetURLForPDF}’);”
value=”#{varsearchResults.pdfURL}”>
<h:outputText style=”vlink.color:red;” styleClass=”outputText”
id=”text7″ value=”#{varsearchResults.formIdAndEditionDate}”
escape=”false”>
</h:outputText>
</hx:outputLinkEx>
[/CODE]

that have been clicked

From what I understand about javascript this function opens as the page does and acts as a listener. When a link with the id ‘text7’ gets clicked it takes this(that link) and changes the color to red. Sounds good, but doesn’t work. Any help would be greatly appreciated.

The site is jsp/jsf/css on:
IE Version: 6.0.2900.2180.xpsp_sp2_qfe.090206-1239

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@cip315authorJun 24.2009 — I think what's going on here is that all the links have the same id and for this to work the id used has to be unique. My guess is it's skipping the script because it doesnt follow the standard. Is there a way to name the links differently or a different way of going about this?
×

Success!

Help @cip315 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...