Depending on which page I am, I would like the content of a javascript function to change.
Example :
MasterPage
<script type="text/javascript">
Cufon.now();
Cufon.replace('p#characters', { fontFamily: 'Helvetica95-Black' });
</script>
Page A
<script type="text/javascript">
Cufon.now();
Cufon.replace('p#characters', { fontFamily: 'Helvetica95-Black' });
Cufon.replace('p#others', { fontFamily: 'Helvetica95-Black' });
</script>
Because I do not want to do code repetition, I'm looking to a solution. I thought that maybe I could use something like a ContentPlaceHolder like this (but it doesn't work) :
<script type="text/javascript">
Cufon.now();
Cufon.replace('p#characters', { fontFamily: 'Helvetica95-Black' });
<asp:ContentPlaceHolder id="cphJS" runat="server" />
</script>
Any way to solve this kind of problem ?
UPDATE
What I will like to avoid is to have code like that :
// Add by MasterPage
<script type="text/javascript">
Cufon.now();
Cufon.replace('p#characters', { fontFamily: 'Helvetica95-Black' });
</script>
// Add by Page A
<script type="text/javascript">
Cufon.now();
Cufon.replace('p#others', { fontFamily: 'Helvetica95-Black' });
</script>
// Add by Page B
<script type="text/javascript">
Cufon.now();
Cufon.replace('p#main', { fontFamily: 'Helvetica95-Black' });
Cufon.replace('p#menu', { fontFamily: 'Helvetica95-Black' });
</script>
Because that kind of code work but it's not the cleaning way of doing it. I would prefer to have something like that :
<script type="text/javascript">
Cufon.now();
Cufon.replace('p#characters', { fontFamily: 'Helvetica95-Black' });
Cufon.replace('p#others', { fontFamily: 'Helvetica95-Black' });
Cufon.replace('p#main', { fontFamily: 'Helvetica95-Black' });
Cufon.replace('p#menu', { fontFamily: 'Helvetica95-Black' });
</script>
The result is the same. I only find that the second output is cleaner.