473,403 Members | 2,183 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,403 software developers and data experts.

Javascript Syntax

Hi all,

I am very new with javascript.. and there is alot i am not sure of

Expand|Select|Wrap|Line Numbers
  1.  
  2. function getMessage(rec,desc,url) 
  3. {     
  4. var ans; ans=window.confirm('The AssetType ' + rec + ' ['+ desc  + '] will be deleted. Would you like to continue?'); //alert (ans); 
  5. if (ans==true) { 
  6.     top.location.href= url + "?Code=" + rec + "&DeleteType=AssetType";
  7.         } 
  8. else { } 
  9. }
  10.  
I have this javascript but I parameter i pass in is causing some problem.
e.g rec = 'abc - sdf'
rec = 'sdf(yes)'
the character "-" and "(" is has cause unterminated string constant error.


Anyone can help me with this problem?? is there a character code to replace those characters??

Thank you in advance
Mar 27 '07 #1
3 927
dorinbogdan
839 Expert 512MB
Strange behavior.
It works fine in IE7 and FireFox2.0 and no error appears.
Mar 27 '07 #2
I am using ie 6.0
I try to investigate into the prob here is how i call the javascript


Expand|Select|Wrap|Line Numbers
  1. getMessage(" + objCellAssetTypeCode.Text + "," + des + ",'AssetDelete.aspx'
where des is a string e.g
'abc+efg'
'abc efg'
'abc (efg)'
Sorry the error does not lies with "-" but the spacing.
Whenever there is a spacing in the string the error will occur. I tried to reform the string with and change 'abc efg' => 'abc'+'efg' but the spacing is gone

The result I want is to display "abc efg" and not "abcefg"
Anyone can help me with this?
Mar 28 '07 #3
dorinbogdan
839 Expert 512MB
You should call :
Expand|Select|Wrap|Line Numbers
  1. getMessage(objCellAssetTypeCode.Text, des, 'AssetDelete.aspx');
  2.  
Mar 28 '07 #4

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

Similar topics

4
by: Owen Parker | last post by:
Hi all I am not a java programmer but i can hack at it a bit. I am trying to allow a user to define the text in a simple javascript text scroller. The data is stored as multiple records in a...
4
by: Ryan Gaffuri | last post by:
I know that this works. I just don't get the syntax. I know its checking the OS. just not sure how it works. var v = navigator.appVersion.toUpperCase() if (1+v.indexOf('WIN98') os =...
3
by: Steve | last post by:
Hi, Does anyone know of any JS syntax checkers for OS X (preferably free!) It's a bit of pain when you write some JS only to find your browser doesn't do what you expect (usually nothing!). ...
1
by: barry | last post by:
Hi I have the following code in a code behind file Dim sString As System.Text.StringBuilder sString = New System.Text.StringBuilder sString.Append("<script language=""Javascript"">" & vbCrLf)...
17
by: korund | last post by:
What is correct syntax for the following scenario: show five alerts, one by one(text different), when page loads in browser -on body onload: alert(text 1) alert(text 2) alert(text 3)...
5
by: pwsmeister | last post by:
I'm fairly new to javascript, my take on the below code is that it is creating a array called event and populating it with 3 functions( add, remove and DOMit). Is my take on this code correct? ...
8
by: fashizzlepop | last post by:
This thread is for all people (n00bs and oldies alike) who need some help with there JavaScript syntax.
9
by: Naomi81 | last post by:
Hello All! I'm brand new to JavaScript, and i've been set the challenge of writing my first program. It's to classify eggs by their size....I've been sat here for about three hours now and cannot...
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: 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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.