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

Expected identifier error on window.confirm, need help

<script>
<!--

function willProceedToPay() {
var willPay = window.confirm('Vill du g' . String.fromCharCode(229) . '
till betaling?');
if (willPay) return true;
return false;
}

//-->
</script>
<form name=betalingForm method=post action=/membersites/betaling.php
onSubmit="return willProceedToPay()">

I can't figure out why I am getting this error. I have a form with a submit
that upon onSubmit will pop up a confirm window asking "Are you sure" (in
Norwegian I hope). Where did I go wrong?

Thanx
Phil
Jul 20 '05 #1
5 7860
Phil Powell wrote:
<script>
<!--

function willProceedToPay() {
var willPay = window.confirm('Vill du g' . String.fromCharCode(229) . '
till betaling?');
if (willPay) return true;
return false;
}

//-->
</script>
<form name=betalingForm method=post action=/membersites/betaling.php
onSubmit="return willProceedToPay()">

I can't figure out why I am getting this error. I have a form with a
submit that upon onSubmit will pop up a confirm window asking "Are you
sure" (in
Norwegian I hope). Where did I go wrong?
Hi Phil,

In Javascript use + for string concatination, no .

try this:
var willPay = window.confirm('Vill du g' + String.fromCharCode(229) + 'till
betaling?');

Thanx
Phil


Welcome. :-)

Regards,
Erwin Moller
Jul 20 '05 #2
"Phil Powell" <so*****@erols.com> writes:
<script>
In HTML 4, the type attribute is required on script tags:
<script type="text/javascript">
<!--
HTML comments are not necessary in script tags.

function willProceedToPay() {
var willPay = window.confirm('Vill du g' . String.fromCharCode(229) . '
till betaling?');
String concatenation in Javascript uses the "+" operator, not "." like
Perl. This is the error.
if (willPay) return true;
return false;
These two lines could just be written as
return willPay;
<form name=betalingForm method=post action=/membersites/betaling.php
onSubmit="return willProceedToPay()">
The action attribute value must be quoted, since it contains "/"
characters. I recommend quoting all attribute values.
I can't figure out why I am getting this error. I have a form with a submit
that upon onSubmit will pop up a confirm window asking "Are you sure" (in
Norwegian I hope). Where did I go wrong?


At the "." :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
I basically had a "blond moment" and forgot about the +. You see, the
script that contained the Javascript code is written in PHP and its
concatenation is "." and not "+". Basically, I got my syntax mixed up;
which I realized much later in the evening or earlier in the morning.

So thanx but I already got it. Finally. :(

Phil

PS: I have used <script> for years w/o fail, I use HTML 4.1

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4
Phil Powell <so*****@erols.com> writes:
PS: I have used <script> for years w/o fail, I use HTML 4.1


No you don't. You *think* you use HTML 4.01, but a script tag
with no type attribute is not HTML 4.01, as any validator will
tell you.

Browsers are used to people writing incorrect HTML, so they happily
accept it anyway, but that doesn't make it correct.

/L 'Pedant? Me? Impossible!'
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #5
Put it to you this way: if it ain't broke, don't fix it.

Not techie, but it's old practical sense from 'back in the day'

Phil

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Squid Seven | last post by:
This is just bizarre. for the following snippet of code: #include <string> using std::string; I get the error message:
2
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
5
by: andy.herrera | last post by:
I'm getting this Error Message. Expected ';' Please Select One: <form name="form1"> <<------------ Error is here. <select name="selectTrans" onChange="If (this.value == 'checkout')...
0
by: Kavitha N via DotNetMonster.com | last post by:
I have 2 frames in my web page. The top frame is just a jscript file which contains the menu items. The bottom frame changes based on the selected menu. I have added this piece of code in my top...
4
by: Kiyomi | last post by:
Hello, I am trying to replace my alert message box with a popup page. In my page behind,
39
by: eruanion | last post by:
Hi, I've been working on this for a while now and I can't seem to find out what is wrong with my code. I have 2 files one c3common.js which only contains javascript functions for my main html page...
9
by: Jack | last post by:
I get the following errors from the code ( CRM 3.0 ) below, whats wrong ? Any suggestions are welcome because i'm kinda stuck here. The first error is pointing on the last bracket ] <--- ...
8
by: trappedIntoCode | last post by:
Hi Everyone, Here is a part of javascript code that works well in FF2 but shows above error in IE6 and error "missing name after . operator" . function...
5
by: nina01 | last post by:
Hi! I'm working on a mini compiler with flex and bison. The ".l" and ".y" files are generated successfully. However, when I try to compile the hole thing using the command "gcc -o comp comp.tab.c...
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: 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
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
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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,...
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.