• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

++ appears before my table??

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again..... :-/
I have a strange problem and can't find anything on it no the net or in my books.
I am printing a table using this function...
But when it prints out to either IE or NS I get a ++ before the table. If create the table in the loop I get a ++ before each table. The ++ doesn't appear in the generated source, but only in the output on the screen. What am I doing wrong?
function buildTable() {
var value = document.form1.rowNum.value;
document.write("<table width='95%' border='1' cellspacing='0' cellpadding='0'>"+
"<tr bgcolor='#FFFFCC'><td colspan='14' class='tableHeader'>Detail of Inquiry</td>"+
"</tr>+<tr>+<td colspan='5' bgcolor='#FFFFCC' class='tableHeader'>General Ledger Code</td>"+
"<td width='7%' class='tableHeader' rowspan='2' align='center' bgcolor='#FFFFCC'>Report<br>Date</td></tr></table>")
for (var i = 1; i <= value; i++) {
document.write("<br>Hello")
}
document.close()
}
 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, (I'm having some trouble with the UBB code).
change this segment

to

[ April 03, 2002: Message edited by: james swan ]
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i tried making a page from your code but it doesnt display anything. im not enough expert to know why. i tried putting it in the body tag but that didnt work either


<html><head></head>
<script language="javascript">
document.write("<table width='95%' border='1' cellspacing='0' cellpadding='0'>"+
"<tr bgcolor='#FFFFCC'><td colspan='14' class='tableHeader'>Detail of Inquiry</td>"+
"</tr><tr><td colspan='5' bgcolor='#FFFFCC' class='tableHeader'>General Ledger Code</td>"+
"<td width='7%' class='tableHeader' rowspan='2' align='center' bgcolor='#FFFFCC'>Report<br>Date</td></tr></table>")
for (var i = 1; i <= value; i++) {
document.write("<br>Hello")
}
document.close()
}
</script>
</html>


i see i missed part of the code i try again
[ April 03, 2002: Message edited by: Randall Twede ]
[ April 03, 2002: Message edited by: Randall Twede ]
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
arg it still doesnt display anything. i will learn this language yet!


<html><head></head>
<script language="javascript">
function buildTable() {
var value = document.form1.rowNum.value;
document.write("<table width='95%' border='1' cellspacing='0' cellpadding='0'>"+
"<tr bgcolor='#FFFFCC'><td colspan='14' class='tableHeader'>Detail of Inquiry</td>"+
"</tr><tr><td colspan='5' bgcolor='#FFFFCC' class='tableHeader'>General Ledger Code</td>"+
"<td width='7%' class='tableHeader' rowspan='2' align='center' bgcolor='#FFFFCC'>Report<br>Date</td></tr></table>")
for (var i = 1; i <= value; i++) {
document.write("<br>Hello")
}
document.close()
}
window.on load = buildTable;
</script>
</html>


i had to change onload to on load so ubb would accept it. anyway i cant see anything wrong with your code i just wanted to see the effect
[ April 03, 2002: Message edited by: Randall Twede ]
 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Correct... that doesn't display anything
there is more to it i didn't think i needed to put it.
If you are trying to use the code i posted put it in between the <head> javaScript in here </head>
in the body of the html i have something like this
<body>
<form name="form1">
<input type="text" name="nameOfTextField">
<input type="button" action="javascript:functionName">
</form>
</body>
just that code it self won't produce anything
and for the ubb code when i'm at work tomorrow i'll cut n paste it again correctly sorry....
and that html code up there isn't 100% right i just whipped it up to give a general idea.
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok,
the reason why ++ would appear on your page is because it got included in the literal HTML that you were generating:
- Strings are delimited by ""
- + can be used to concatenate Strings
- some of your +'s were included in the Strings and are being treated as literals as opposed to contentation operators.
I tried to explain that in my post above, but didn't do such a good job.
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
james,
d'oh. now i see what the problem was i thought rich had posted your first post and was just clarifying...i should pay more attention

rich, james is absolutely correct. his code change should fix your problem
[ April 03, 2002: Message edited by: Randall Twede ]
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Randall, Rich,
sorry for the confusion, I was originally trying to highlight the part of Rich's code that had the issue, with the UBB bold tag, but it wasn't working out for me.
So after 3 attempts the above post was the outcome (it made sense in my mind ).
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
james, no need for apologies you solved his problem
im not real fond of UBB myself. i find it very iritating to have to modify the code for events when html is supposed to be disabled. it has even been mentioned in the moderators only forum that this is a pain.
[ April 03, 2002: Message edited by: Randall Twede ]
[ April 03, 2002: Message edited by: Randall Twede ]
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in fact i think something must be done about it. at least some message in this forum saying you dont have to change all your <'s and >'s but only have to change the event code. i am gonna go start a thread about it.
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it's done, hopefully soon there will be bold red text explaing about the shortcoming of UBB and what to do. i hate to imagine someone tediously changing all their <'s and >'s because thats what UBB recommends
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no responses yet in moderators only but it is now night for most of them...ill keep you informed if there are any beneficial changes. i definatetly want some bold red near the top that briefly explains the prob and what to do about it.
im just asking for help for this one problem, if anyone doesnt understand the UBB codes, click the link to your left. it explains it.
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
arg.. its not always there on my left
http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=ubb_code_page
 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Randall and James
Thanks for replying.
You were right with the pluses. I didn't see them in there.
Thanks for helping!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic