Difficulty calling a javascript function?

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 20th, 2005, 20:19
New Member
Join Date: Jul 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
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="">

...
Reply With Quote

  #2 (permalink)  
Old Jul 20th, 2005, 20:45
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
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".
Reply With Quote
  #3 (permalink)  
Old Jul 20th, 2005, 20:58
New Member
Join Date: Jul 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Jeff but it still doesn't seem to work (I'm still not getting any alert pop-up).
Reply With Quote
  #4 (permalink)  
Old Jul 21st, 2005, 04:21
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
mm, try moving the function to the beginning of the script block.
Reply With Quote
  #5 (permalink)  
Old Jul 21st, 2005, 17:48
New Member
Join Date: Jul 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Hmmm, it turns out I hadn't properly instantiated the getSelectedServers object/method whatever. Javascript is cool but weird. Thanks for the help.
Reply With Quote
Reply

Tags
difficulty, calling, javascript, function

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 10:30.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43