Jump to content

simple Javascript Playing with my brain


severndigital

Recommended Posts

ok ..

i have a very simple javascript function

 

function textSize(indexNum,methodName){

var formName;
	formName = document.getElementsByName('textForm');

if(methodName == 'iFontSize'){
	//add one to current font size and submit the form	
	formName[indexNum].textSize.value++;
	document.textForm.submit();
}else if(methodName == 'dFontSize'){
	//subtract one from current font size and sumbit the form
	formName[indexNum].textSize.value--;
	document.textForm.submit();
}
}

 

when i run the function is does the math correctly but javascript errors and says "document.textForm.submit is not a function.

 

there are a few forms on the page, so I am using the index of the form to set the correct fields value.

 

here is how i am invoking the javascript

 

<form name="textForm" method="POST" action="process.php">
<input type="text" name="textSize" value="5">
<img src="add.gif" onClick="textSize(0,'iFontSize');">
</form>

 

there is more to the form and the page, but that's the meat of this problem.

 

any ideas??

 

Thanks,

-C

Link to comment
https://forums.phpfreaks.com/topic/129294-simple-javascript-playing-with-my-brain/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.