/    Sign up×
Community /Pin to ProfileBookmark

Simple If statement not working

Hi Everyone,

I am having a little difficulty getting my If statement to work within Javascript. What is currently happening is the the true statement is working (where P_User_Active1 =1) however the else content is not showing running. Is there anything that I am missing below? Any help would greatly be appreciated!

=============================================

<SCRIPT TYPE=’text/javascript’ LANGUAGE=’JavaScript’>
if (GetElqContentPersonalizationValue(‘P_User_Active1’)==1)
{
document.write(‘<p>’);
document.write(‘<span class=”body”>’);
document.write(GetElqContentPersonalizationValue(‘P_FirstName’));
document.write(‘&nbsp;’);
document.write(GetElqContentPersonalizationValue(‘P_LastName’));
document.write(‘<br>’);
document.write(GetElqContentPersonalizationValue(‘P_Title’));
document.write(‘<br>’);
document.write(‘Email:&nbsp;’);
document.write(‘<a href=”mailto:’);
document.write(GetElqContentPersonalizationValue(‘P_EmailAddress’));
document.write(‘”>’);
document.write(GetElqContentPersonalizationValue(‘P_EmailAddress’));
document.write(‘</a>’);
document.write(‘<br>’);
document.write(‘Phone:&nbsp;’);
document.write(GetElqContentPersonalizationValue(‘P_BusPhone’));
document.write(‘</p>’);
document.write(‘</span>’);
}
else

{
document.write(‘<p>’);
document.write(‘<span class=”body”>’);
document.write(‘Marketing’);
document.write(‘&nbsp;’);
document.write(Last Name”);
document.write(‘<br>’);
document.write(‘Title’);
document.write(‘<br>’);
document.write(‘Email:&nbsp;’);
document.write(‘<a href=”mailto:’);
document.write(‘[email protected]’);
document.write(‘”>’);
document.write(‘[email protected]’);
document.write(‘</a>’);
document.write(‘<br>’);
document.write(‘Phone:&nbsp;’);
document.write(‘650-555-5555’);
document.write(‘</p>’);
document.write(‘</span>’);
}

</SCRIPT>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@ZeroKilledDec 18.2007 — on your else clause you got this line outside a literal string:

document.write(Last Name'');

where should be:

[b]document.write('Last Name');[/b]
×

Success!

Help @steveo93 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...