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