473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

pass variable through onclick()

1
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" >
  2. need this code to work please help i'm bignner
  3.  
  4. function showmsg(arg)
  5. {
  6.     alert(arg);
  7. }
  8. </script> <?php 
  9. $msg="hello";
  10. echo '<img src="http://bytes.com/img/icons/ico_rej.gif" alt=""  style="cursor:pointer" onclick="showmsg($msg)" />';
  11.  
  12. ?>
Oct 2 '12 #1
1 1464
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

You need to surround the value that you pass into the javascript in quotes. Otherwise it won't recognize it as a string.
Oct 2 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: weiwei | last post by:
Hi all How can I pass the variable in two button situation see below code <html> <body> <form action="" method="post"> <input type="text" name="name"> <input type="button" value="Add"...
2
by: umashd | last post by:
Hi, I am doing a web based project for my graduation. I studied bit of java for backend processesing and javascript for the client. Here is the scenario. In the FORM, I use INPUT TYPE=text...
5
by: GB | last post by:
Hello: In my MS Access project I have two objects - my form and my report. I need to pass variable value from Command_click procedure of my form to Report_open procedure of my report. How can I...
1
by: Ben Kial | last post by:
I'd like to write a wrapper function "mysprintf(char *buffer, char *format, ....)" which calls sprintf(). My question is how can I pass variable argument in mysprintf() to sprintf(). Thanks in...
1
by: dollar | last post by:
I want to ask what is the best way to pass variable between asp.net we pages, and user controls , any examples - dolla -----------------------------------------------------------------------...
3
by: manmit.walia | last post by:
Hi, I have a small question...Is there a way to do a postback to the same page and pass a value to a function OnClick? Example: void GetCityName(string c) { string city = c; }
1
by: vijaynarang | last post by:
strCmdLine = " " + " -o restore -url " + sSitePath + "/sites/" + sToplevelSiteName + " -filename " + sFileName+ " -overwrite "; process1 =...
12
by: simon2x1 | last post by:
i have a page which is home.php on that page i have a CSS tab which is tab1 and tab2 on that page in both tabs i have a link called next that pass variable to the next page (<a...
2
by: peachdot | last post by:
hi, The MainForm will have 2 buttons: 1.) Button A : User click button A, hide Mainform then go to form1. User enter data in the textbox.Click finish button,form1 close then go back to...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.