473,395 Members | 1,624 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,395 software developers and data experts.

Elementary question I suppose, using the parameters.

I'm new to javascript and I have run into a problem I bet someone here
can help me with. I have a little web page that includes this call to
another html file with two parameters:

<a href="car.html?chevy.jpg|nameone">
<img src="slides/chevythumbnail.jpg" >
</a>

So when I click on the chevythumbnail image, it brings up the car.html
page with the parameter string. I have figured out how read and parse
the parameter string in the car.html file so in the script portion I
have defined:

var carparams = new Array[2]
and I have managed to set carparams[0] and carparams[1] to the strings
"chevy.jpg" and "nameone" from the parameters. So far, so good.

Now I want to display the image in a table like in this snippet
(there's more to the table, but this illustrates):

<tr>
<td align="center"><img src="chevy.jpg"></a>
</td>
</tr>
<tr>
<td align = "center"><anameone</a>
</td>
</tr>

The problem is that I want the name of that chevy.jpg and its label
nameone underneath to come from the carparams array.

Heeeelp please.

--Lynn
Oct 23 '07 #1
9 1221
On Oct 22, 6:51 pm, "[Mr.] Lynn Kurtz" <ku...@asu.edu.invalidwrote:
I'm new to javascript and I have run into a problem I bet someone here
can help me with. I have a little web page that includes this call to
another html file with two parameters:

<a href="car.html?chevy.jpg|nameone">
I'm curious why choose to use of the vertical bar character in a URL.
That is not common.
<img src="slides/chevythumbnail.jpg" >
</a>

So when I click on the chevythumbnail image, it brings up the car.html
page with the parameter string. I have figured out how read and parse
the parameter string in the car.html file so in the script portion I
have defined:

var carparams = new Array[2]
and I have managed to set carparams[0] and carparams[1] to the strings
"chevy.jpg" and "nameone" from the parameters. So far, so good.

Now I want to display the image in a table like in this snippet
(there's more to the table, but this illustrates):

<tr>
<td align="center"><img src="chevy.jpg"></a>
</td>
</tr>
<tr>
<td align = "center"><anameone</a>
</td>
</tr>

The problem is that I want the name of that chevy.jpg and its label
nameone underneath to come from the carparams array.
This should be very possible using innerHTML or some combination of
functions like createElement() and appendChild().

What exactly does your table HTML look like before the img and a
elements you show above are inserted? Are the tr elements you show
above already there? Are the td elements you show above already there?
Does the table have a tbody element? It will need to have a tbody
element if the tr elements are not there.

Peter

Oct 23 '07 #2
On Tue, 23 Oct 2007 03:34:39 -0000, Peter Michaux
<pe**********@gmail.comwrote:
>On Oct 22, 6:51 pm, "[Mr.] Lynn Kurtz" <ku...@asu.edu.invalidwrote:
>I'm new to javascript and I have run into a problem I bet someone here
can help me with. I have a little web page that includes this call to
another html file with two parameters:

<a href="car.html?chevy.jpg|nameone">

I'm curious why choose to use of the vertical bar character in a URL.
That is not common.
I'm new at this. I just wanted a string delimiter for the parameter
string and | looks nice to me. I don't recognize it as a URL, just a
parameter string, no?
>
><img src="slides/chevythumbnail.jpg" >
</a>

So when I click on the chevythumbnail image, it brings up the car.html
page with the parameter string. I have figured out how read and parse
the parameter string in the car.html file so in the script portion I
have defined:

var carparams = new Array[2]
and I have managed to set carparams[0] and carparams[1] to the strings
"chevy.jpg" and "nameone" from the parameters. So far, so good.

Now I want to display the image in a table like in this snippet
(there's more to the table, but this illustrates):

<tr>
<td align="center"><img src="chevy.jpg"></a>
</td>
</tr>
<tr>
<td align = "center"><anameone</a>
</td>
</tr>

The problem is that I want the name of that chevy.jpg and its label
nameone underneath to come from the carparams array.

This should be very possible using innerHTML or some combination of
functions like createElement() and appendChild().
Could you be a bit more specific?
>What exactly does your table HTML look like before the img and a
elements you show above are inserted? Are the tr elements you show
above already there? Are the td elements you show above already there?
Does the table have a tbody element? It will need to have a tbody
element if the tr elements are not there.
The below stripped down table shows the picture of Chevy.jpg and below
puts a label nameone. That is the effect I seek. I just need to know
how to change it so it uses the strings in the carparams array in the
script section instead of hardcoded in these lines.

<table>
<tr>
<td align="center"><img src="Chevy.jpg"></a>
</td>
</tr>
<tr>
<td align = "center"><anameone</a>
</td>
</tr>
</table>

--Lynn
Oct 23 '07 #3
On Oct 22, 10:21 pm, "[Mr.] Lynn Kurtz" <ku...@asu.edu.invalidwrote:
On Tue, 23 Oct 2007 03:34:39 -0000, Peter Michaux

<petermich...@gmail.comwrote:
On Oct 22, 6:51 pm, "[Mr.] Lynn Kurtz" <ku...@asu.edu.invalidwrote:
I'm new to javascript and I have run into a problem I bet someone here
can help me with. I have a little web page that includes this call to
another html file with two parameters:
<a href="car.html?chevy.jpg|nameone">
I'm curious why choose to use of the vertical bar character in a URL.
That is not common.

I'm new at this. I just wanted a string delimiter for the parameter
string and | looks nice to me. I don't recognize it as a URL, just a
parameter string, no?
I'd guess something like this would be more common...

car.html?img=chevy.jpg&caption=nameone

It's not important for your problem below. I was just curious.
<img src="slides/chevythumbnail.jpg" >
</a>
So when I click on the chevythumbnail image, it brings up the car.html
page with the parameter string. I have figured out how read and parse
the parameter string in the car.html file so in the script portion I
have defined:
var carparams = new Array[2]
and I have managed to set carparams[0] and carparams[1] to the strings
"chevy.jpg" and "nameone" from the parameters. So far, so good.
Now I want to display the image in a table like in this snippet
(there's more to the table, but this illustrates):
<tr>
<td align="center"><img src="chevy.jpg"></a>
</td>
</tr>
<tr>
<td align = "center"><anameone</a>
</td>
</tr>
The problem is that I want the name of that chevy.jpg and its label
nameone underneath to come from the carparams array.
This should be very possible using innerHTML or some combination of
functions like createElement() and appendChild().

Could you be a bit more specific?
What exactly does your table HTML look like before the img and a
elements you show above are inserted? Are the tr elements you show
above already there? Are the td elements you show above already there?
Does the table have a tbody element? It will need to have a tbody
element if the tr elements are not there.

The below stripped down table shows the picture of Chevy.jpg and below
puts a label nameone. That is the effect I seek. I just need to know
how to change it so it uses the strings in the carparams array in the
script section instead of hardcoded in these lines.

<table>
<tr>
<td align="center"><img src="Chevy.jpg"></a>
</td>
</tr>
<tr>
<td align = "center"><anameone</a>
</td>
</tr>
</table>
But what does the table's html look like _before_ it has the image
filename and the caption inserted?

<table>
<tr>
<td align="center"><img src="">
</td>
</tr>
<tr>
<td align = "center"><a></a>
</td>
</tr>
</table>

or

<table>
<tr>
<td align="center">
</td>
</tr>
<tr>
<td align = "center">
</td>
</tr>
</table>

or

<table>
<tr>
</tr>
<tr>
</tr>
</table>

or

<table>
</table>

I'm trying to determine how much of the HTML needs to be built up by
the JavaScript.

Peter

Oct 23 '07 #4
[Mr.] Lynn Kurtz a pensé très fort :
On Tue, 23 Oct 2007 03:34:39 -0000, Peter Michaux
<pe**********@gmail.comwrote:
>On Oct 22, 6:51 pm, "[Mr.] Lynn Kurtz" <ku...@asu.edu.invalidwrote:
>>I'm new to javascript and I have run into a problem I bet someone here
can help me with. I have a little web page that includes this call to
another html file with two parameters:

<a href="car.html?chevy.jpg|nameone">

I'm curious why choose to use of the vertical bar character in a URL.
That is not common.

I'm new at this. I just wanted a string delimiter for the parameter
string and | looks nice to me. I don't recognize it as a URL, just a
parameter string, no?
>
why don't you use forms?

http://www.javaworld.com/jw-06-1996/...avascript.html

- you are too new with it and don'k know nothing about its existence?
- or you dont want to use them?
Oct 23 '07 #5
On Tue, 23 Oct 2007 05:31:29 -0000, Peter Michaux
<pe**********@gmail.comwrote:

>But what does the table's html look like _before_ it has the image
filename and the caption inserted?

<table>
<tr>
<td align="center"><img src="">
</td>
</tr>
<tr>
<td align = "center"><a></a>
</td>
</tr>
</table>

or

<table>
<tr>
<td align="center">
</td>
</tr>
<tr>
<td align = "center">
</td>
</tr>
</table>

or

<table>
<tr>
</tr>
<tr>
</tr>
</table>

or

<table>
</table>

I'm trying to determine how much of the HTML needs to be built up by
the JavaScript.
OK, it's a script I am writing, so it could be any of these. Let's
assume I have everything except displaying the image and caption, so
it's like this, just awaiting the remaining code:
><table>
<tr>
<td align="center">
</td>
</tr>
<tr>
<td align = "center">
</td>
</tr>
</table>
I actually have a longer parameter list and more rows and columns, but
if I can see how to do this I should be able to figure out the rest.

--Lynn
Oct 23 '07 #6
On Tue, 23 Oct 2007 11:56:56 +0200, matatunos <ma*******@gmail.com>
wrote:

>
why don't you use forms?

http://www.javaworld.com/jw-06-1996/...avascript.html

- you are too new with it and don'k know nothing about its existence?
- or you dont want to use them?
It's my first attempt at javascript and I have a simple one time need.
I have browsed a javascript tutorial so I am aware of forms. If I have
to learn forms to do it, I guess I will, but I was thinking that might
be overkill for what I want to do. But maybe not.

--Lynn
Oct 23 '07 #7
Peter Michaux wrote:
On Oct 22, 6:51 pm, "[Mr.] Lynn Kurtz" <ku...@asu.edu.invalidwrote:
>I'm new to javascript and I have run into a problem I bet someone here
can help me with. I have a little web page that includes this call to
another html file with two parameters:

<a href="car.html?chevy.jpg|nameone">

I'm curious why choose to use of the vertical bar character in a URL.
That is not common.
It is forbidden. ASCII characters that are not alphanumeric or otherwise in
the unreserved set, that are not sub-delimiters, and that are not in the
reserved set, have to be percent-encoded in the query part of an URI (here
as %7C). See RFC 3986, section 3.4.
>The problem is that I want the name of that chevy.jpg and its label
nameone underneath to come from the carparams array.

This should be very possible using innerHTML or some combination of
functions like createElement() and appendChild().
Where the latter is to be preferred.
PointedEars
Oct 23 '07 #8
Thomas 'PointedEars' Lahn wrote:
Peter Michaux wrote:
>I'm curious why choose to use of the vertical bar character in a URL.
That is not common.

It is forbidden. ASCII characters that are not alphanumeric or otherwise in
the unreserved set, that are not sub-delimiters, and that are not in the
reserved set, have to be percent-encoded in the query part of an URI (here
as %7C). See RFC 3986, section 3.4.
Sorry for the nitpick, but RFC states 'unwise' rather than
'forbidden'. Section 2.4.3. 'Excluded US-ASCII Characters' in RFC2396:

| Other characters are excluded because gateways and other transport
| agents are known to sometimes modify such characters, or they are
| used as delimiters.
| unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"

Note that this excerpt also explicitly mentions that vertical bars
actually *are* used as delimiters (I think this statement would be
based upon practical 'as is' observation on the Internet).

But I would not rely on user agents to handle the vertical bar
consistently. To play safe, use '&'.

--
Bart

Oct 25 '07 #9
On Thu, 25 Oct 2007 01:45:20 -0700, Bart Van der Donck
<ba**@nijlen.comwrote:
>Thomas 'PointedEars' Lahn wrote:
>Peter Michaux wrote:
>>I'm curious why choose to use of the vertical bar character in a URL.
That is not common.

It is forbidden. ASCII characters that are not alphanumeric or otherwise in
the unreserved set, that are not sub-delimiters, and that are not in the
reserved set, have to be percent-encoded in the query part of an URI (here
as %7C). See RFC 3986, section 3.4.

Sorry for the nitpick, but RFC states 'unwise' rather than
'forbidden'. Section 2.4.3. 'Excluded US-ASCII Characters' in RFC2396:

| Other characters are excluded because gateways and other transport
| agents are known to sometimes modify such characters, or they are
| used as delimiters.
| unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"

Note that this excerpt also explicitly mentions that vertical bars
actually *are* used as delimiters (I think this statement would be
based upon practical 'as is' observation on the Internet).

But I would not rely on user agents to handle the vertical bar
consistently. To play safe, use '&'.
Probably not critical in my application, but I am changing it to the
ampersand. Thanks for the replies.

--Lynn
Oct 26 '07 #10

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

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
5
by: Lionel B | last post by:
Greetings, I am trying to implement "element-wise" arithmetic operators for a class along the following lines (this is a simplified example): // ----- BEGIN CODE ----- struct X { int a,b;
18
by: Merrill & Michele | last post by:
Today is when I sing in the choir, and I was thinking about rehearsal tonight when I realized that in order to be in the C choir, I had to buy K&R to be reading the same "music." I am familiar...
29
by: Merrill & Michele | last post by:
I'm now looking at page 115 K&R. After having discussed counterexamples, I shall herewith and henceforth make all my c programs look like int main(int orange, char* apple) {return(0);} Q1) ...
0
by: Geoffrey L. Collier | last post by:
I wrote a bunch of code to do elementary statistics in VB, and would prefer to find code in C# to recoding all of the VB code. A search of the web found very little. Does anyone know of a good...
8
by: pauldepstein | last post by:
I am writing a program which looks at nodes which have coordinates which are time-dependent. So I have a class called node which contains the private member declarations int date; int month; ...
3
by: pauldepstein | last post by:
I am writing a program to calculate prices of commodity options as part of my Masters degree in Finance. (Absolutely no prior knowledge of computer programming was assumed.) I am representing...
6
by: pauldepstein | last post by:
Suppose I have a function f from integers to integers. Besides mapping x to f(x) the function does lots of other things as well -- for example f displays a message on screen etc. I then want...
5
by: bromio | last post by:
can someone help me to make code for digital clock using AT89S52. The specs of clock are 12 hour clock,am-pm display,use timer interrupts to have delay.two external inputs to adjust hours and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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:
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
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...

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.