This is a discussion on "Difficulty calling a javascript function?" within the JavaScript Forum section. This forum, and the thread "Difficulty calling a javascript function? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Difficulty calling a javascript function?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Difficulty calling a javascript function?
I hope that this is an easy question to answer. I have a javascript function embedded in an asp page that I can't seem to be able to call (the reason I think this is because the "alert" inside the js function isn't being called). The global variables work fine. I also have a number of vbscript functions declared that I haven't pasted here. Any ideas?
<head><title>Yeah</title> <script language="JavaScript" type="text/javascript" src="OptionTransfer.js"></script> <script language="JavaScript" type="text/javascript"> <!-- var opt = new OptionTransfer("list1","list2"); opt.setAutoSort(true); opt.setDelimiter(","); opt.saveNewRightOptions("newRight"); function addDelServField(){ var jsServ = opt.getSelectedServers(); theForm.delServerNames.value = jsServ; alert("jsServStr: "+jsServStr); } //--> </script> </head> ... <form id="theForm" method=post action="defineClusters.asp"> <input type="submit" name="deleteCluster" value="Delete Cluster" onclick="javascript:addDelServField()"> <input type="hidden" id="delServerNames" name="delServerNames" value=""> ... |
|
|
|
|||
|
Just a suggestion off the top of my head but I'd take the javascript: out from in front of the function name and use a input type="button" rather than "submit".
|
|
|||
|
Thanks Jeff but it still doesn't seem to work (I'm still not getting any alert pop-up).
|
|
|||
|
mm, try moving the function to the beginning of the script block.
|
![]() |
| Tags |
| difficulty, calling, javascript, function |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| calling functions in a function | fatsurfer | PHP Forum | 1 | Jun 12th, 2008 21:53 |
| calling php function on click of a hyperlink | csun | PHP Forum | 2 | Jul 15th, 2007 16:27 |
| problem calling function via onClick | Eagle | JavaScript Forum | 5 | Jan 15th, 2007 21:41 |
| plz help me verify this... calling function | melvinoyh | JavaScript Forum | 0 | May 29th, 2006 01:35 |
| calling a javascript function in from VBscript | jakyra | Classic ASP | 2 | Sep 22nd, 2003 23:13 |