Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 25th, 2012, 12:11 PM
Authorized User
Points: 67, Level: 1
Points: 67, Level: 1 Points: 67, Level: 1 Points: 67, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default Confirmation box

When the user clicks the submit button, a confirmation dialog box appears asking them if they want to continue. i am trying to pass a php variable to the js method, but it doesn't seem to like it. here is my code:

js:
Code:
<script type="text/JavaScript">
<!--
function show_confirm(str)
{
	var r=confirm("Are you sure you would like to change your username to " + str + "?");
}
//   -->
</script>
html:
Code:
 <?php $uname = "username"; ?>
<input type="submit" name="submit" id="submit" value="Submit" class="button" onclick="show_confirm($uname)" />
Reply With Quote
  #2 (permalink)  
Old February 26th, 2012, 12:55 AM
Friend of Wrox
Points: 742, Level: 10
Points: 742, Level: 10 Points: 742, Level: 10 Points: 742, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2009
Location: Tehran, Iran
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile use quotes and <?php

you should use quotes and <?php tag :

HTML Code:
<?php $uname = "username"; ?>
<input type="submit" name="submit" id="submit" value="Submit" class="button" onclick="show_confirm('<?php echo $uname ?>')" />
__________________
happy every time, happy every where

Reza Baiat
Reply With Quote
The Following User Says Thank You to irProject For This Useful Post:
droidus (February 26th, 2012)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Confirmation Messagebox sm.ibrahim BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 1 January 30th, 2008 12:21 AM
Delete Confirmation From within a Gridview rit01 ASP.NET 2.0 Professional 5 March 8th, 2007 06:47 PM
Email Confirmation Katachi Dreamweaver (all versions) 1 December 18th, 2005 07:19 AM
delete confirmation yami56 Access 2 April 7th, 2004 12:09 PM
Pop up Delete confirmation box... developerz BOOK: ASP.NET Website Programming Problem-Design-Solution 1 October 8th, 2003 01:41 PM



All times are GMT -4. The time now is 10:27 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.