helloise Posted March 24, 2011 Share Posted March 24, 2011 how can i achieve this please? i have: <script type="text/JavaScript"> function getChoice(val) { yesNo = new Array("Yes", "No"); var getsel = document.contactus.yesnolist.value; var e = document.getElementById("yesnolist"); var strUser = e.options[e.selectedIndex].value; if (strUser == "no") { //go the the faq page here?????? } return strUser; } thank you Quote Link to comment https://forums.phpfreaks.com/topic/231592-link_to-for-js/ Share on other sites More sharing options...
.josh Posted March 24, 2011 Share Posted March 24, 2011 I see all kinds of things either straight up wrong or don't make sense in your function...but it's hard to help when you don't explain what it is you are actually trying to do. If I had to take a guess...I "guess" you are trying to grab a value from a form element and based on the value, either return that value or else redirect to some other page? Also, post the relevant html that this javascript is supposed to work with. And use code tags for code you post. [ code]your code here[ /code] (but without the spaces) Quote Link to comment https://forums.phpfreaks.com/topic/231592-link_to-for-js/#findComment-1191874 Share on other sites More sharing options...
helloise Posted March 25, 2011 Author Share Posted March 25, 2011 will this help??? <div id='div_phone_big'> </div> <head> <script type="text/JavaScript"> function getChoice(val) { yesNo = new Array("Yes", "No"); var getsel = document.contactus.yesnolist.value; var e = document.getElementById("yesnolist"); var strUser = e.options[e.selectedIndex].value; if (strUser == "no") { //go the the faq page here } return strUser; } function getCommChoice() { comm = new Array("Compliment","Complaint","Feedback","Suggestion","Billing Query","Other"); var getsel = document.contactus.commlist.value; document.contactus.commtext.value = comm[getsel]; } function sayThanks() { alert("Thank you for submitting"); return true; } </script> </head> <body> <form name = "contactus" method="post" onSubmit="return sayThanks()"> <table class='table_format_content_rbc' border='0'> <div> <span class='spn_big_lightblue_rbc'>RAINBOW</span><span class='spn_big_black_rbc'>CODE: CONTACT US </span> <td colspan='3' align='left' class='small_header_rbc'> <h3>Problems and general queries</h3> <li>Phone our call centre on 086 110 6472 ( Available 8am-5pm from monday-friday ) or</li> <li>Email us at <a href="mailto:helloise@pagesalive.co.za">feedback@miranetworks.net</a> </li> </td> </div> <div> <tr></tr> <tr></tr> <tr> <td colspan='3' align='left' class='small_header_rbc'> <h3>Frequently Asked Questions</h3> <li>Please take a moment to read the Frequently Asked Questions as the solution to your query could be waiting for you there!</li> <li>Have you read the <?php echo link_to('FAQ','util/faq') ?> ? <select id="yesnolist" onChange="getChoice(this.value)"> <option value="yes" selected="selected">Yes</option> <option value="no">No</option> </select> </li> </tr> <tr></tr> <tr></tr> </div> <div> <tr> <td colspan='3' align='left' class='small_header_rbc'> <h3>Feedback and Suggestions</h3> <li>E-mail address to reply to: <input type="text" name="emailreply"> </li> <li>Nature of communication: <select name="commlist" onChange="getCommChoice()"> <option value="compliment">Compliment</option> <option value="complaint">Complaint</option> <option value="feedback">Feedback</option> <option value="suggestion">Suggestion</option> <option value="billquery">Billing Query</option> <option value="other">Other</option> </select> </li> <textarea name="message" rows="10" cols="20"></textarea> <br /><br /> <?php $to = "helloise@pagesalive.co.za"; $subject = $_REQUEST["commlist"]; $email = $_REQUEST["emailreply"]; $message = $_REQUEST["message"]; $headers = "From: $email"; mail($to, $subject, $message, $headers); //echo $to." ".$subject." ".$message." ".$email." ".$headers; ?> <input type="submit" value="Send"> <input type="reset" value="Reset"> </td> </tr> </div> </table> <table class='table_format_content_rbc' border='0'> <tr> <td colspan='3' align='left' class='small_header_rbc'> <br/> </td> <tr> </table> </form> </body> thanks Quote Link to comment https://forums.phpfreaks.com/topic/231592-link_to-for-js/#findComment-1192055 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.