![]() |
return a value in javascript help needed
i have this line of code:
Code:
<a href="#" id="profilelink" name="link2" onClick="viewornot(<?php echo $freechat_id ?>)"><?php echo $freechat_list; ?></a>Code:
function viewornot(id)thank you |
Send value back to what? Where do you produce the message box? Where is the "send button"? What kind of element is? What does it do? Which is the whole procedure of "sending message"? Detail, please.
|
1. send a value back from where i called the onclick in the href
2. i will only do the message box and send button once i know it the user clicked on the OK of the confirm in my javascript code <a href="#" id="profilelink" name="profilelink" onClick="return viewornot(<?php echo $freechat_id ?>)"><?php echo $freechat_list; ?></a> //check here if OK was clicked then produce message box and send button if isset($_POST['profilelink']) ///i get error here: Undefined index: profilelink in { //do message box and send button } function viewornot(id) { var e = confirm('Do you want to view this profile?'); if (e == true) { window.location.href = "http://www-rainbowcode-net/apps_dev.php/profiles/showprofilepersonal?id="+id; window.location('http://www-rainbowcode-net/apps_dev.php/profiles/showprofilepersonal?id='+id); return true; } else { var e2 = confirm('Do you want to send a message?'); if (e2 == true) { document.getElementById('profilelink').value = e2; return e2; } } } hope this helps?? thank you |
Quote:
|
Quote:
function viewornot(id) { var e = confirm('Do you want to view this profile?'); if (e == true) { window.location.href = "http://www-rainbowcode-net/apps_dev.php/profiles/showprofilepersonal?id="+id; window.location('http://www-rainbowcode-net/apps_dev.php/profiles/showprofilepersonal?id='+id); return true; } else { var e2 = confirm('Do you want to send a message?'); if (e2 == true) { //i know user clicked ok thus wants to send a message document.getElementById('profilelink').value = 1; return 1; } } } <a href="#" id="profilelink" name="profilelink" onClick="return viewornot(<?php echo $freechat_id ?>)"><?php echo $freechat_list; ?></a> <?php if (isset($_POST['profilelink']) == 1) { echo "ok was clicked"; //not executing! ?> //now do a message area with a submit or cancel button <textarea name="message" rows="10" cols="20"></textarea> <br /><br /> <input type="submit" value="Send"> <input type="reset" value="Reset" name='reset'> <?php } ?> |
I have already seen your JS, but I don't understand which is your aim. I need you to describe your aim in plain words.
I see also you are looking for a PHP query, but I see no form there. |
a user clicks on the link in the href( a nother user's profile)..it calls the JS in the js i ask if the user want to preview the profile of the person he just clicked on..if the user clicks cancel another popup comes up which asks if the user wants to send a message to the profile of the user he clicked on... if the user clicks ok i want to produce a message box with a submit button
more than this i cant explain...it is just that simple what i want to do... if the user clicked yes bring up a message box with a submit botton |
Finally :)
What about this? Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
yikes! finally it works thank you VERY much! i learnt something!
|
| All times are GMT +1. The time now is 08:21 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.