|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
eval and function calling
Hi All,
I'm a newbie to javascript and was hoping for some help. The goal is to add some text to a textarea via an input button. So my JS: //mainInput = name of textarea function addtext(formname,reqText) { insert = true; if (insert) { eval(formname + '.' + mainInput + '.value += \"<\"' + reqText + '\">\";'); } eval(theform + '.' + mainInput + '.focus();'); } I recieve an Expected ";" error from IE for the eval line. The strange thing is if i move the semi-colon to -1 of the closing eval bracket i.e. eval('whatever' ; I recieve a different error saying Object Expected, referring to the line with the input button which calls function addtext:<input type="button" value="Harvey" onclick="addText(this.form,'harvey')" title="Harvey" accesskey="h"> ...even stranger, is that if i do move the semi-colon to left of the closing eval bracket, no alert statements are executed?? does anyone have any ideas, i will be very grateful... Thanks All, Harvey ![]() |
|
#2
|
|||
|
|||
|
no worries...
...just realised how stupid i was being, i didn't have the formname in the quotes, due to it being an object and not a string.... cheers anyway... Harvey ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > eval and function calling |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|