Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/231592-link_to-for-js/
Share on other sites

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)

 

Link to comment
https://forums.phpfreaks.com/topic/231592-link_to-for-js/#findComment-1191874
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/231592-link_to-for-js/#findComment-1192055
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.