LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 04-09-2004, 12:00 PM   #1
maseby
Member
 
Registered: Oct 2003
Posts: 42

Rep: Reputation: 15
Javascript


Does anyone know howto output a <table>
using the alert(); statement
 
Old 04-09-2004, 06:16 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
I'm not 100% sure what you mean but if I'm correct then this is the closest I can come up with:
Code:
<html><body><script lannguage="javascript">
var one = new Array();
var two = new Array();
var three = new Array();
var four = new Array();
var maxone=0;
var maxtwo=0;
var maxthree=0;
var maxfour=0;
var i=0;
var table;

one[i]="Colour";
two[i]="Red";
three[i]="Green";
four[i]="Blue";
i++;
one[i]="Blue"
two[i]="00";
three[i]="00";
four[i]="FF";
i++;
one[i]="Red";
two[i]="FF";
three[i]="00";
four[i]="00";
i++;
one[i]="Green";
two[i]="00";
three[i]="FF";
four[i]="00";
i++;

for(num=0; num<i; num++){
if(one[num].length>maxone){maxone=one[num].length+2}
if(two[num].length>maxtwo){maxtwo=two[num].length+2}
if(three[num].length>maxthree){maxthree=three[num].length+2}
if(four[num].length>maxfour){maxfour=four[num].length+2}
}

for(num=0; num<i; num++){
while(one[num].length<maxone){one[num]+="_"}
while(two[num].length<maxtwo){two[num]+="_"}
while(three[num].length<maxthree){three[num]+="_"}
while(four[num].length<maxfour){four[num]+="_"}
table+="\n"+one[num]+two[num]+three[num]+four[num];
}

alert(table);

</script></body></html>
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript help darin3200 General 4 09-04-2005 12:58 AM
javascript in <td>? akaash Programming 0 03-18-2004 01:22 AM
JavaScript TextAreas jacksmash Programming 9 12-27-2003 02:02 PM
Help with javascript? BajaNick Linux - Software 2 07-20-2003 09:41 PM
javascript?? Marci Sarwan Programming 1 01-18-2001 10:18 AM


All times are GMT -5. The time now is 01:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration