www.webdeveloper.com
Results 1 to 3 of 3

Thread: Multiple argument call problem

  1. #1
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    88

    Multiple argument call problem

    Hi, I'm trying to pass the value of a radio button to a function when a textarea detects a keypress event. I can't figure out why this error is happening though...
    Code:
    Error: SyntaxError: missing ) after argument list
    Line: 1, Column: 29
    Source Code:
    getMoreInfoResults(this.value; document.question_form.vote.value;)
    HTML Code:
    <div id="pollElement">
    <h3>Do you like money?</h3>
    <form name="question_form">
    	<input type="radio" name="vote" value="1" onclick="getVote(this.value)" />Yes<br />
    	<input type="radio" name="vote" value="2" onclick="getVote(this.value)" />No<br />
    	<h3>Why?</h3>
    	<textarea rows="3" name="moreInfo" onkeyup="getMoreInfoResults(this.value; document.question_form.vote.value;)" /></textarea><br />
    	<input type="submit" value="Submit" />
    	<div id="otherAnswers">You can optionally type an answer.</div>
    </form>
    </div>
    Code:
    function getMoreInfoResults(input, int) {
    
    if (window.XMLHttpRequest)
      { // code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      } else { // code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    
    xmlhttp.onreadystatechange=function() {
    
    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
      document.getElementById("otherAnswers").innerHTML=xmlhttp.responseText;
    }
    
    }
    
    xmlhttp.open("GET","phpPoll/phpPoll_userDefined/functions/getMoreInfoResults.php?moreInfo="+input,true);
    xmlhttp.open("GET","phpPoll/phpPoll_userDefined/functions/getMoreInfoResults.php?vote="+int,true);
    
    xmlhttp.send();
    
    }
    Does anyone know why this is happening?
    Thanks

  2. #2
    Join Date
    Sep 2012
    Location
    Toronto
    Posts
    16
    getMoreInfoResults(this.value; document.question_form.vote.value
    arguments should be comma separated, not semicolon.

    try changing it to

    getMoreInfoResults(this.value, document.question_form.vote.value)

  3. #3
    Join Date
    Jan 2011
    Location
    United Kingdom, London
    Posts
    117
    Quote Originally Posted by leke View Post
    Hi, I'm trying to pass the value of a radio button to a function when a textarea detects a keypress event. I can't figure out why this error is happening though...
    Code:
    Error: SyntaxError: missing ) after argument list
    Line: 1, Column: 29
    Source Code:
    getMoreInfoResults(this.value; document.question_form.vote.value;)
    HTML Code:
    <div id="pollElement">
    <h3>Do you like money?</h3>
    <form name="question_form">
    	<input type="radio" name="vote" value="1" onclick="getVote(this.value)" />Yes<br />
    	<input type="radio" name="vote" value="2" onclick="getVote(this.value)" />No<br />
    	<h3>Why?</h3>
    	<textarea rows="3" name="moreInfo" onkeyup="getMoreInfoResults(this.value; document.question_form.vote.value;)" /></textarea><br />
    	<input type="submit" value="Submit" />
    	<div id="otherAnswers">You can optionally type an answer.</div>
    </form>
    </div>
    Code:
    function getMoreInfoResults(input, int) {
    
    if (window.XMLHttpRequest)
      { // code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      } else { // code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    
    xmlhttp.onreadystatechange=function() {
    
    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
      document.getElementById("otherAnswers").innerHTML=xmlhttp.responseText;
    }
    
    }
    
    xmlhttp.open("GET","phpPoll/phpPoll_userDefined/functions/getMoreInfoResults.php?moreInfo="+input,true);
    xmlhttp.open("GET","phpPoll/phpPoll_userDefined/functions/getMoreInfoResults.php?vote="+int,true);
    
    xmlhttp.send();
    
    }
    Does anyone know why this is happening?
    Thanks
    what those semicolons are doing in firing method? it should be colon, and just one, functionName(attr1, attr2)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles