Jump to content


Photo

Any Idea Why This Wont work


  • Please log in to reply
5 replies to this topic

#1 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 07 August 2006 - 09:55 AM

Hi any ideas why the confirm dialog wont show?

// 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>
		<?
	}

http://thewebsolutionprovider.com - A Solution For Everything Web!

#2 Chips

Chips
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 07 August 2006 - 01:41 PM

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...

#3 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 07 August 2006 - 01:46 PM

Javascript doesn't insist on semi-colons after each statement, but the lack of the closing bracket would certainly prevent that code from running.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#4 killerb

killerb
  • Members
  • PipPipPip
  • Advanced Member
  • 48 posts

Posted 07 August 2006 - 01:50 PM

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!
Experience is something you get just after you need it.

#5 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 07 August 2006 - 01:53 PM

// 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>
		<?
	}


#6 killerb

killerb
  • Members
  • PipPipPip
  • Advanced Member
  • 48 posts

Posted 07 August 2006 - 01:59 PM

Well they both worked for me.
Experience is something you get just after you need it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users