Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
naming function incrementally
Old 06-25-2007, 11:02 AM naming function incrementally
Average Talker

Posts: 22
Trades: 0
Hi,

i have a problem regarding mys javascript function.
i have several forms which name's like this:

PHP Code:
for($i=0$i<$period$i++)
{
  
$queryCount"select appId, appTypeName, appStatName from appointment where appId= '$appId'";
  
$resultsafe_query($queryCount);
  
$num_rows mysql_num_rows($result);
  while (list(
$appId$appTypeName$appStatName)= mysql_fetch_array($result))
  {
     print 
"<form name= \"bookAppointmentc$appId\" id= \"bookAppointmentc$appId\" action= \"../action/bookAppointment.php\" method= \"GET\">";
     print 
"<select name= \"appStatName\" class= \"onProgress\" onChange= \"return changeAppc$appId()\">\n";
     .....
     print 
"<a href= \"javascript: submitFormc$appId()\"> Changeaa </a> \n";
  }

since i don't really good at javascript, i create the javascript func like this:

Code:
function bookAppointmentc1()
{
 ...
}

function bookAppointmentc2()
{
 ...
}
and so on..
i know it's wrong, but i don't know how to make it right?
or is there any other way in creating the form name in php?

thank's for your attention
moccacinoe is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-30-2007, 07:07 AM Re: naming function incrementally
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Why would you want to create so many functions when you would simply have one function and pass the ID or the name of the form object? It is a formula destined for disaster.

you would simply need;
HTML Code:
function BookAppointment(objID) {
...
}
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to naming function incrementally
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.68508 seconds with 12 queries