473,657 Members | 2,627 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is this correct?

I am new at coding and would like to know if the following is correct:

I want to be able to list information repeatedly with the same text added to
it.
Don't know if this is the way to do it, but it prints out OK for me.
Now, in order to get the items listed vertically, I used the 'join' Method
with <br>; is this correct?
The only problem is there is no text after the last value("g"), so I
inserted empty "" marks as the last value.
Is there a better way to do this, w/o the empty value at the end?

Code:

<html>
<body>

<!-- saved from url=(0014)about :internet -->
<script language="JavaS cript" type="text/javascript">

var alphabet = new Array("a","b"," c","d","e","f", "g","");
var Alphabet = alphabet.join(" is a letter of the alphabet.<br>") ;

document.write( Alphabet);
</script>
</body>
</html>
Jul 23 '05 #1
2 1279
ommadawn wrote:
I am new at coding and would like to know if the following is correct:

I want to be able to list information repeatedly with the same text added to
it.
Don't know if this is the way to do it, but it prints out OK for me.
Now, in order to get the items listed vertically, I used the 'join' Method
with <br>; is this correct?
The only problem is there is no text after the last value("g"), so I
inserted empty "" marks as the last value.
Is there a better way to do this, w/o the empty value at the end?

Code: <script type="text/javascript">
document.write(["a","b","c","d" ,"e","f","g"].join
(" is a letter of the alphabet.<br>") +"<BR>")
</script>

Mick
<html>
<body>

<!-- saved from url=(0014)about :internet -->
var alphabet = new Array("a","b"," c","d","e","f", "g","");
var Alphabet = alphabet.join(" ");

Alphabet);
</script>
</body>
</html>

Jul 23 '05 #2
ommadawn wrote on 30 apr 2005 in comp.lang.javas cript:
I am new at coding and would like to know if the following is correct:

I want to be able to list information repeatedly with the same text
added to it.
Don't know if this is the way to do it, but it prints out OK for me.
Now, in order to get the items listed vertically, I used the 'join'
Method with <br>; is this correct?
The only problem is there is no text after the last value("g"), so I
inserted empty "" marks as the last value.

Code:

<html>
<body>

<!-- saved from url=(0014)about :internet -->
<script language="JavaS cript" type="text/javascript">
language="JavaS cript" has been deprecated for years.

var alphabet = new Array("a","b"," c","d","e","f", "g","");
var Alphabet = alphabet.join(" is a letter of the alphabet.<br>") ;

document.write( Alphabet);
</script>
</body>
</html>
Are you happy with the result? Then why change it?
Is there a better way to do this, w/o the empty value at the end?


"Better" is in the hand of the beholder.

<script type="text/javascript">
var tx = ' is a letter of the alphabet.<br>';
var result = 'abcdefg'.split ('').join(tx)+t x;

document.write( result)
</script>

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #3

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

Similar topics

6
3014
by: David Opstad | last post by:
I have a question about text rendering I'm hoping someone here can answer. Is there a way of doing linguistically correct rendering of Unicode strings in Python? In simple cases like Latin or Japanese I can just print the string and see the correct results. However, I don't know how to get Python to do the right thing for writing systems which require contextual processing. For example, let's say I create this Unicode string in Arabic: ...
0
10728
by: Sarah Tegtmeier | last post by:
Hi I have a question about the correct use of the attribute xsi:schemaLocation. My programm has to process XML files where the value of this attribute causes some problems. The programm is written in C++ using Xerces C++ version 2.3.0. An older older version of the programm used Xerces C++ version 1.6.0. The XML files look like the following example:
1
7756
by: Richard Golebiowski | last post by:
I have been trying to figure this out for quite some time and cannot find any examples in VB.Net or in VB that work correctly. I am working on an application where I want the user to be able to select a peinter and printer tray to print reports out. In Crystal Reports 8.5, I can select a printer and tray and it prints correctly. I did a test report that I use to tell me the value that Crystal Reports is using for the paper source. When I...
14
2153
by: john.burton.email | last post by:
I've done some extensive searching and can't seem to find an answer to this - Is it correct to using "using" with templates, for example: using std::vector; Or do I need to specify the type too: using std::vector<int>; Both seem to "work" on the compiler I have and I can't find any documentation saying which is correct, or are both correct?
6
3479
by: Rob Thorpe | last post by:
Given the code:- r = sscanf (s, "%lf", x); What is the correct output if the string s is simply "-" ? If "-" is considered the beginning of a number, that has been cut-short then the correct output is that r = EOF. If it is taken to be a letter in the stream, then the output should be r = 0, as far as I can see. My compiler gives EOF.
5
2508
by: blackg | last post by:
Input string not in correct format -------------------------------------------------------------------------------- I am trying to view a picture from a table. I am getting this error Input string not in the correct format. Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it...
2
4978
by: thisis | last post by:
Hi All, I need the PUBS.mdb for pulling images: PUBS.mdb must have the table: pub_info tbl_pub_info : has 3 fields Data_Type : ok Data_Type : ok
0
3162
by: sehguh | last post by:
Hiya Folks, I am Currently using windows xp. Also using Visual Web Developer 2005 and Microsoft Sql server 2005. The main page consists of an aspx page and a master page. The page also consists of a label control(hidden when run in browser). Also an Sql data source control connected to database tables for a photo album. Also label web control ID=UserIdValue. Also a Details View control ID=dvPictureInsert Problem is how to work out...
3
1730
lee123
by: lee123 | last post by:
I have a problem getting the correct to count +1 every time I get an answer right and the incorrect is the same. I have two lbl's named number1 and number2 which produces a Rnd# in each lbl. I have a txt box for the answer called useranswer. A button to check if the answer is right called btnanswer. I have just added two more lbl's for the correct named lblcorrect & the other is lblincorrect. How do I get this to count when the...
10
2199
by: onetruelove | last post by:
I want to creat a post like this blog: http://onlinetoefltest.blogspot.com/2007/08/level-c-lesson-1.html When you chose all the answers and click show answer a msg box will appear and tells how many answers are correct I view the blog source and copied all the code to my post but it didn't work when i click the show answer button in my post. Can any one help me with the code? Thanks in advance
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.