onclick - Help with HTML server request syntax - concat strings -


i trying execute script when button pressed on webpage. following code works:

<input type="button" onclick="newajaxcommand('focuser1.htm?moveout=100');" value="out" style="width: 130px; height: 80px"> 

instead of sending hardcoded value of 100 want send whatever number entered in textbox on page looks this...

<input type="text" name="inc" maxlength="10" style="width: 80px" value="10"> <input type="submit" name="setinc" value="set" style="width: 75px;"> 

so sure have syntax wrong want do:

<input type="button" onclick="newajaxcommand('focuser1.htm?moveout=" + document.getelementbyid('inc').value" ');" value="out" style="width: 130px; height: 80px"> 

is possible?

yes, possible

<input type="button" onclick="newajaxcommand('focuser1.htm?moveout=' + document.getelementbyid('inc').value);" value="out" style="width: 130px; height: 80px"> 

ah, , need add id attribute text input

<input type="text" id="inc" maxlength="10" style="width: 80px" value="10">  

anyway, think better such things within function:

function newajaxcommand(url, id) {      //do url , document.getelementbyid(id); } 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -