473,383 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Getting JavaScript error: "Cannot assign to '[string]'"

i have a java script function with the pop up i want to update a database ow i am getting the erorr any one please help me with this.

code is like this
Expand|Select|Wrap|Line Numbers
  1.  
  2.         <script type="text/javascript">
  3.  function disp_confirm(employeenominationid)
  4.   {
  5.  
  6.  
  7.   var r=confirm('Are you sure ?:'+employeenominationid)
  8.    if (r==true)
  9.     {
  10.     window.location = 'Winner.aspx?EmpNomId='++;employeenominationid;
  11.  
  12.  document.Form1.submit()
  13.       }
  14.   else
  15.     {
  16.  
  17.     //document.write("You pressed Cancel!")
  18.     }
  19.   }
  20.  
  21.         </script>
  22.  
Aug 10 '07 #1
7 3056
pbmods
5,821 Expert 4TB
Heya, Preeti.

Here's where your problem lies:
Expand|Select|Wrap|Line Numbers
  1. 'Winner.aspx?EmpNomId='++;
  2.  
This code attempts to increment the value of 'Winner.aspx?EmpNomId=' by 1 and then save then new value to itself, which is just wrong on so many levels.

P.S., Changed thread title to better describe the problem (did you know that thread titles that do not follow the Posting Guidelines actually get FEWER responses?).
Aug 10 '07 #2
thanks for replying .but i need that id because based on that id i am try to update the database do i need a server side code for that please help me i feel really stuck in there
Aug 10 '07 #3
pbmods
5,821 Expert 4TB
Heya, Preeti.

The problem is not the 'Winner.aspx?EmpNomId=' part. The problem is the '++;' part.

Did you mean this instead:
Expand|Select|Wrap|Line Numbers
  1.  window.location = 'Winner.aspx?EmpNomId=' + employeenominationid;
  2.  
Aug 10 '07 #4
thanks for helping me out but now i want that id in the url how i can get that id in the url please tell
Aug 10 '07 #5
pbmods
5,821 Expert 4TB
Heya, Preeti.

To put the id in the URL, you'd simply do this:
Expand|Select|Wrap|Line Numbers
  1. window.location = 'Winner.aspx?EmpNomId=' + employeenominationid;
  2.  
Which is different from what you were trying to do previously:
Expand|Select|Wrap|Line Numbers
  1. window.location = 'Winner.aspx?EmpNomId='++;employeenominationid;
  2.  
Aug 10 '07 #6
yes sir as you said i made a change in the code my code is now look like this
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  function disp_confirm(employeenominationid)
  3.   {
  4.  
  5.  
  6.   var r=confirm('Are you sure ?:'+employeenominationid)
  7.    if (r==true)
  8.     {
  9.  
  10. window.location ='Winner.aspx?EmpNomId=' + employeenominationid;
  11.  document.Form1.submit()
  12.       }
  13.   else
  14.     {
  15.  
  16.     //document.write("You pressed Cancel!")
  17.     }
  18.   }
  19.  
  20.         </script>
  21.  
  22.  
and server side code i am call a qurey string like this

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.             string EomNomid;
  4.             EomNomid = Request.QueryString["employeenominationid"];
  5.  
  6.  
Aug 10 '07 #7
pbmods
5,821 Expert 4TB
Heya, Preeti.

Close.

Your server-side code doesn't talk with JavaScript that way, so instead of using the name of the JavaScript variable, you need to use the name that you put in the URL:

Expand|Select|Wrap|Line Numbers
  1. string EomNomid;
  2. EomNomid = Request.QueryString["EmpNomId"];
  3.  
Aug 10 '07 #8

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

Similar topics

1
by: Fie Fie Niles | last post by:
I have IIS installed on XP Professional workstation machine. I have an ASP page that open connection to an Access database, then when trying to update the database, it gave me the error "cannot...
2
by: Andreas Poller | last post by:
Hello, I have the following problem: I have a class deriving from ICustomTypeDescriptor: public __gc class TPropertyBag : public ICustomTypeDescriptor { private: ...
0
by: Chun | last post by:
Dear All I am now facing a problem when i try to pass a custom datatable datatype value to a remote server. In the remote server, a method with System.Data.DataTable as input parameter is...
2
by: Florian G. Pflug | last post by:
Hi Since sometime yesterday, my postgresql (7.4.5) reports "ERROR: cannot compare arrays of different element types", when I analyze a specific table in my database. Here is the tables...
1
by: marknewbery | last post by:
Hi, I have been trying to get a php, mySQL install to work and talk together on Windows XP SP2 with IIS. So far I installed and received a responce from php(V5 - manual install) though the ...
6
by: Don Lancaster | last post by:
I need to progrmatically do this inside a loop this.fh03.value = fixFloat (Harms, numPoints) ; with the numbers changing per an index. If I try curHvals = "03" ; // (derived from...
4
by: Don Lancaster | last post by:
I want to programically generate some JS variable names in a loop. The variables are NOT to be array values. The variable names might be eq0, eq1, eq2.... Inside an ii indexed loop, eval...
2
by: ironmanlarry | last post by:
Hi, I'm trying to do a mail merge from Excel to Word (programatically) and I'm having some trouble creating the Word Document Object. This line of code wordDoc = GetObject("sheet.doc") keeps...
7
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.