473,804 Members | 3,526 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Button click function call doesn't work: probably syntax problem

1 New Member
Hello. I have the following function:

Expand|Select|Wrap|Line Numbers
  1. function delProd(codproddel, rowNr) {
  2. var agree=confirm("Esti sigur ca vrei sa stergi produsul?");
  3. if (agree)
  4.     {
  5. var elTRdel = $('produse').insertRow( -1 );
  6. var cell5 =  elTRdel.insertCell( -1 );
  7. //cell5.setAttribute("colspan","7");
  8. var inp5 =  document.createElement("input");
  9. inp5.setAttribute("type","hidden");
  10. inp5.setAttribute("name","deletedprod[]");
  11. inp5.setAttribute("value",+codproddel+);
  12. cell5.appendChild(inp5);
  13. document.getElementById('produse').deleteRow(rowNr);
  14.     }
  15. else
  16.     {
  17.     return false;
  18.     }
  19. }
  20.  

I call it like this:
Expand|Select|Wrap|Line Numbers
  1. <input type='button' value='Delete' onclick="return delProd(<?=$codproduscom?>,this.parentNode.parentNode.rowIndex);">

but it doesnt seem to work. I think that the problem is a very simple syntax thing, but I'm a beginner in JS and it's killing me.

Many thanks!
Apr 3 '08 #1
2 1410
hsriat
1,654 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. function delProd(codproddel, rowNr) {
  2.     var agree=confirm("Esti sigur ca vrei sa stergi produsul?");
  3.     if (agree)
  4.     {
  5.         var elTRdel = document.getElementById('produse').insertRow( -1 );
  6.         var cell5 =  elTRdel.insertCell( -1 );
  7.         //cell5.setAttribute("colspan","7");
  8.         var inp5 =  document.createElement("input");
  9.         inp5.setAttribute("type","hidden");
  10.         inp5.setAttribute("name","deletedprod[]");
  11.         inp5.setAttribute("value",codproddel);
  12.         cell5.appendChild(inp5);
  13.         document.getElementById('produse').deleteRow(rowNr);
  14.     }
  15.     else
  16.     {
  17.         return false;
  18.     }
  19. }
  20.  
Expand|Select|Wrap|Line Numbers
  1. <input type='button' value='Delete' onclick="return delProd('<?=$codproduscom?>',this.parentNode.parentNode.rowIndex);">
See if this works...
Apr 3 '08 #2
acoder
16,027 Recognized Expert Moderator MVP
Changed the thread title. Please Use a Good Thread Title. Thanks!
Apr 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
4967
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
11
13964
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to all users (btnSendAll). When user hits enter, I also simulate the effect of clicking button (btnSend). However, what I found btnSend doesn't fire (unless I click on the button). The postback function I call is as follows: function...
14
4976
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
9
2792
by: Neo Geshel | last post by:
I have strip-mined, strip-searched, and completely exhausted the Internet (up to the 30th page on Google, with 100 results per page!!), all without finding an answer to my question AS TO WHY IT IS IMPOSSIBLE TO PROGRAMMATICALLY ADD A BUTTON TO A DYNAMICALLY CREATED PAGE. Or, to be more precise, why it is impossible to have an onClick sub respond to that button’s Click event. My main page has only one line:
2
4287
by: dunderhead | last post by:
Hello, I am having a problem with function and class syntax. I have one class (MakePanel1) that creates a button and label. The button-click event of the button is linked to a function (daclick1) that changes the text of the label. This works well. I have another class (MakePanel2) that creates a second button. I want this second button to call the button-click function of the first button. My incorrect call MakePanel1.daclick1()...
28
4720
by: Bill | last post by:
Hello All, I am trying to pass a struct to a function. How would that best be accomplished? Thanks, Bill
2
5369
by: Debbie | last post by:
I have always used VBScript but now need to convert my syntax to JavaScript. In an external file, I have a function that is called when a user clicks a button on a login page. The function checks the format of data that has been entered by the user and makes sure that all required fields have been filled out. On the login page, between the <head></headtags I have the following syntax: <script language="javascript"...
18
2629
by: bning | last post by:
Hmm this forum really doesn't give you long enough to type in your question before logging you out.. well here goes my second attempt: I'm trying to teach myself javascript with dom scripting and am attempting to write an application as I learn. It's been going fine but I've ran into a problem which is driving me crazy. I'll start off by explaining what I'm trying to achieve... I'm simply trying to insert an input button into a table at a...
8
4751
by: Harvey Schmidlapp | last post by:
I have a fairly complex form (generated by means of an ASP 3 page). The form is used to define a query against a database. After running a query, the user hits their browser's back button and goes back to the form, where their selections show up. They can change whatever they want to change and resubmit the new query. Mostly, everything works fine, with radio buttons, selection lists, check boxes all coming back in the state they were in...
0
9588
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10589
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.