473,399 Members | 3,302 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,399 software developers and data experts.

What happened to my code

Dear all,

I have the following java code:

<script language="javascript" type="text/javascript">

var customearray = new array(400);

for (var i=0;i<400;i++) {
customarray[i] = "'" + <%=rs("name")%+ "'";
}

</script>

The broser complians at for (var i=0;i<400;i++) {customarray[i] = "'"
+ <%=rs("name")%+ "'";}

It saids ";" is needed. What's wrong with my code?

Thanks.
Jun 27 '08 #1
13 1078
hon123456 wrote:
Dear all,

I have the following java code:

<script language="javascript" type="text/javascript">

var customearray = new array(400);

for (var i=0;i<400;i++) {
customarray[i] = "'" + <%=rs("name")%+ "'";
}

</script>

The broser complians at for (var i=0;i<400;i++) {customarray[i] = "'"
+ <%=rs("name")%+ "'";}

It saids ";" is needed. What's wrong with my code?

Thanks.
How about change <%=rs("name")%to <%=rs("name");%>
--
Xu, Qian (stanleyxu)
http://stanleyxu2005.blogspot.com
Jun 27 '08 #2
On Apr 29, 12:52 am, hon123456 <peterhon...@yahoo.com.hkwrote:
Dear all,

I have the following java code:

<script language="javascript" type="text/javascript">

var customearray = new array(400);

for (var i=0;i<400;i++) {
customarray[i] = "'" + <%=rs("name")%+ "'";
}

</script>

The broser complians at for (var i=0;i<400;i++) {customarray[i] = "'"
+ <%=rs("name")%+ "'";}

It saids ";" is needed. What's wrong with my code?

Thanks.
What does <%= rs("name") %expand to? Also, this is getting expanded
server-side, right?
Jun 27 '08 #3
On 4$B7n(B29$BF|(B, $B2<8a(B1$B;~(B52$BJ,(B, apatheticagnostic <apatheticagnos...@gmail.com>
wrote:
On Apr 29, 12:52 am, hon123456 <peterhon...@yahoo.com.hkwrote:


Dear all,
I have the following java code:
<script language="javascript" type="text/javascript">
var customearray = new array(400);
for (var i=0;i<400;i++) {
customarray[i] = "'" + <%=rs("name")%+ "'";
}
</script>
The broser complians at for (var i=0;i<400;i++) {customarray[i] = "'"
+ <%=rs("name")%+ "'";}
It saids ";" is needed. What's wrong with my code?
Thanks.

What does <%= rs("name") %expand to? Also, this is getting expanded
server-side, right?- $Bp,i6Ho0zMQJ8;z(B -

- $Bp}<(Ho0zMQJ8;z(B -
Yes..It is server side variable . Thanks
Jun 27 '08 #4
On 4$B7n(B29$BF|(B, $B2<8a(B2$B;~(B14$BJ,(B, hon123456 <peterhon...@yahoo.com.hkwrote:
On 4$B7n(B29$BF|(B, $B2<8a(B1$B;~(B52$BJ,(B, apatheticagnostic <apatheticagnos...@gmail.com>
wrote:


On Apr 29, 12:52 am, hon123456 <peterhon...@yahoo.com.hkwrote:
Dear all,
I have the following java code:
<script language="javascript" type="text/javascript">
var customearray = new array(400);
for (var i=0;i<400;i++) {
customarray[i] = "'" + <%=rs("name")%+ "'";
}
</script>
The broser complians at for (var i=0;i<400;i++) {customarray[i] = "'"
+ <%=rs("name")%+ "'";}
It saids ";" is needed. What's wrong with my code?
Thanks.
What does <%= rs("name") %expand to? Also, this is getting expanded
server-side, right?- $Bp,i6Ho0zMQJ8;z(B -
- $Bp}<(Ho0zMQJ8;z(B -

Yes..It is server side variable . Thanks- $Bp,i6Ho0zMQJ8;z(B -

- $Bp}<(Ho0zMQJ8;z(B -
rs("name") is a recordset field for ASP. Thanks
Jun 27 '08 #5
hon123456 escribió:
I have the following java code:

<script language="javascript" type="text/javascript">

var customearray = new array(400);

for (var i=0;i<400;i++) {
customarray[i] = "'" + <%=rs("name")%+ "'";
}
I see you don't even know what language the code is in :) The main part
is JavaScript, not Java. And the <% ... %part is ASP, which is a
server-side language: it should never reach the browser.

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 27 '08 #6
hon123456 wrote:
Dear all,
I have the following java code:
You have the following ASP/Javascript code.
<script language="javascript" type="text/javascript">
var customearray = new array(400);
No such thing as array, you mean Array.
for (var i=0;i<400;i++) {
customarray[i] = "'" + <%=rs("name")%+ "'";
}
</script>
You're writing to customarray instead of customearray. One of them is
spelled wrongly. Plus you're writing the same value 400 times. I'll
assume this is just because you've abstracted the real problem to a
simpler postable version.
The broser complians at for (var i=0;i<400;i++) {customarray[i] = "'"
+ <%=rs("name")%+ "'";}
It saids ";" is needed. What's wrong with my code?
Thanks.
Perhaps "name" is returning something with quotes in it. Try commenting
that line out and replacing it with customarray[i]="hello". That will
indicate that there's something wrong with what's being returned from
"name". It's probably got quotes in it. You could try putting an alert
in there to show what's being inserted.
Jun 27 '08 #7
On Apr 29, 3:20*am, "Álvaro G. Vicario"
<alvaroNOSPAMTHA...@demogracia.comwrote:
hon123456 escribió:
* * * * * I have the following java code:
<script language="javascript" type="text/javascript">
var customearray = new array(400);
for (var i=0;i<400;i++) {
* *customarray[i] = "'" *+ <%=rs("name")%+ "'";
* *}

I see you don't even know what language the code is in :) The main part
is JavaScript, not Java. And the <% ... %part is ASP,
or JSP, it uses the same syntax and has...long before ASP even
existed.

which is a
server-side language: it should never reach the browser.

--
--http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:http://bits.demogracia.com
-- Mi web de humor al baño María:http://www.demogracia.com
--
Jun 27 '08 #8
Instead of ...

customarray[i] = "'" + <%=rs("name")%+ "'";

use ...

customarray[i] = "'<%=rs("name")%>'";

Graham
Jun 27 '08 #9
Or even ...

customarray[i] = "<%=rs("name")%>";
Jun 27 '08 #10
Laser Lips wrote:
Or even ...
customarray[i] = "<%=rs("name")%>";
That won't work because of the nested quotes.
Jun 27 '08 #11
Stevo <no@mail.invalidwrites:
Laser Lips wrote:
>Or even ...
customarray[i] = "<%=rs("name")%>";

That won't work because of the nested quotes.
I'd be surprised if it doesn't work.

The quotes outside of "<%" and "%>" are in a completely different
scope and should not be considered at all when parsing the server-side
code. That, on the other hand, will be replaced by a text that,
hopefully, doesn't contain quotes before reaching the browser.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jun 27 '08 #12
Lasse Reichstein Nielsen wrote:
Stevo <no@mail.invalidwrites:
>Laser Lips wrote:
>>Or even ...
customarray[i] = "<%=rs("name")%>";
That won't work because of the nested quotes.
I'd be surprised if it doesn't work.
The quotes outside of "<%" and "%>" are in a completely different
scope and should not be considered at all when parsing the server-side
code. That, on the other hand, will be replaced by a text that,
hopefully, doesn't contain quotes before reaching the browser.
Good point, I'm not a server-side person. What you say makes sense.
Jun 27 '08 #13
Tom Cole wrote:
On Apr 29, 3:20 am, "Ãlvaro G. Vicario"
>[...] And the <% ... %part is ASP,

or JSP, it uses the same syntax and has...long before ASP even
existed.
It could even be PHP, with enabled support for ASP-style tags. Possible,
but recommended against for shipping code due to possible incompatibility.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jun 27 '08 #14

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

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
4
by: Ruud de Jong | last post by:
The question I have is: how safe / future proof / portable is the use of the __subclasses__ method that exists for new-style classes? Background: I thought I had found an easy-to-understand...
7
by: Neil Zanella | last post by:
OK, this time the compiler's got me a little bit puzzled, simply because it is doing something I am not expecting. My understanding, according to the documentation of std::vector<>::resize(), is...
2
by: Lauren Wilson | last post by:
Hi folks, Just "upgraded" from A2K to A2K3. Everything is just hunky dory (so far) -- EXCEPT that the Add-in I had with A2K that auto inserts error code is no longer available in the Add-in...
1
by: Mikey | last post by:
Can somebody tell me what happened to the Source Profiler? It used to be under the Build menu in VC6, but now it's gone, and I cannot find anything in the docs that say what happened to it. The...
1
by: JS | last post by:
Hello, I am using ASP .Net to create my own web controls and I have noticed that there is one too many requirements that forces the developer to be aware of and get involved with. In the past...
9
by: Jay | last post by:
Everywhere I go (read/browse) I see these parameters.... ByVal sender As Object, ByVal e As System.EventArgs Yet I never see them used within the function/method. Could someone tell me what they...
15
by: Steven T. Hatton | last post by:
I found the example code below, listed in the book described here: http://cartan.cas.suffolk.edu/moin/OopDocbookWiki The result was a bit surprising. I guess it falls into the category of...
5
by: adam.timberlake | last post by:
I've just finished reading the article below which goes into some depth about exceptions. The article was rather lucid and so I understand how to implement it all, the thing I'm having trouble with...
3
by: Giampaolo Rodola' | last post by:
http://groups.google.com/group/python-dev2 It seems it no longer exists. What happened?
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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.