Jump to content

Archived

This topic is now archived and is closed to further replies.

glenelkins

Any Idea Why This Wont work

Recommended Posts

Hi any ideas why the confirm dialog wont show?

[code]
// Check if the user has finished creating their profile
if ($finished == 0) {
?>
<script language="javascript">
if (confirm ('Have You Finished Creating Your Wedding Page?')) {
alert ("Ok");
} else {
alert ("Bummer")
</script>
<?
}
[/code]

Share this post


Link to post
Share on other sites
no closing bracket on the else statement, no semi colon line termination after the second alert, and only short php tag used to return to php?

Dunno if those are "bugs" per say, my javascript is shaky...

Share this post


Link to post
Share on other sites
Javascript doesn't insist on semi-colons after each statement, but the lack of the closing bracket would certainly prevent that code from running.

Share this post


Link to post
Share on other sites
I have had errors from validator.w3c.org that 'language' is not a valid attribute for a script tag, though I think I have had js running in tags like that before. Use type="text/javascript" anyway, I don't know if that will fix it, it looks OK to me.

We must be nearing the end of the world - computers are not obeying our command!

Share this post


Link to post
Share on other sites
[code]// Check if the user has finished creating their profile
if ($finished == 0) {
?>
<script type='text/javascript'>
if (confirm ('Have You Finished Creating Your Wedding Page?')) {
alert ("Ok");
} else {
alert ("Bummer")
}
</script>
<?
}[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.