Reputation: 1991
So, I'm working with JSF 2.0, and I've created a javascript that looks like this:
<script type="text/javascript">
function generate(){
if(!licenseServerInfo){
NI.pnx.messaging.popMessage(NI.pnx.messaging.messageTypes.warning,['<strong>Your changes to License Server Name and Computer ID have not been saved.</strong><a href="" class="right"><strong>Undo Change</strong></a>'],NI.pnx.messaging.messageTimeoutSpeeds.never);
}else{
generateLicenseFile();
document.getElementById('upperButtons:generateCall').click();
}
}
</script>
But it's rendered like this:
<script type="text/javascript"><!--
function generate(){
if(!licenseServerInfo){
NI.pnx.messaging.popMessage(NI.pnx.messaging.messageTypes.warning,['<strong>Your changes to License Server Name and Computer ID have not been saved.
//--></strong><a class="right"><strong>Undo Change<!--
function generate(){
if(!licenseServerInfo){
NI.pnx.messaging.popMessage(NI.pnx.messaging.messageTypes.warning,['<strong>Your changes to License Server Name and Computer ID have not been saved.
//--></strong><!--
function generate(){
if(!licenseServerInfo){
NI.pnx.messaging.popMessage(NI.pnx.messaging.messageTypes.warning,['<strong>Your changes to License Server Name and Computer ID have not been saved.
//--></a>'],NI.pnx.messaging.messageTimeoutSpeeds.never);
}else{
generateLicenseFile();
document.getElementById('upperButtons:generateCall').click();
}
}
<!--
function generate(){
if(!licenseServerInfo){
NI.pnx.messaging.popMessage(NI.pnx.messaging.messageTypes.warning,['<strong>Your changes to License Server Name and Computer ID have not been saved.
//--></script>
Using chrome's console, if I call each of the contained functions, they all work right. But if I try to call generate(), it says it doesn't exist.
Any ideas?
Upvotes: 0
Views: 54
Reputation: 395
On one hand, it looks you're generating that code inside a loop (that's why the function is being written multiple times). On the other hand you could try setting your script inside a <![CDATA[ ]]>
to avoid the browser trying to parse it
Upvotes: 1