For Programmers: Free Programming Magazines  


Home > Archive > Java Help > June 2005 > Newbie question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Newbie question
CK.

2005-06-06, 4:00 pm

Hi,

In HTML I have this functioncall: viewpic(img)
In the function in a *.js-file I have: function viewpic(img)
In a document.write() routine (found on the internet) the image is displayed
perfect.
Now I want to put some data below the picture.
For transfer from HTML to the funtion I have:
imagefilename, name, 'date in string'

I presume these must be in 1 string delimited with ','
How van I transfer these three data from HTML to the function and plit them.
Finding:
function viewPic(img)
{
String[] tokens = String.split(",",img);
for (int i = 0, i < tokens.length; ++i) {
System.out.println(tokens[i]);
}
}

but can't get this split to:
var img = imagefilename
var cName = name
var cDate = "date in string"

and how must I join the filename+","+name+","+date to img in HTML

Any help would be appreaciated.

Chris
A VisualFoxpro-er stepping into HTML and Java-world


Andrew Thompson

2005-06-06, 4:00 pm

On Mon, 6 Jun 2005 13:49:20 +0200, CK. wrote:

> A VisualFoxpro-er stepping into HTML and Java-..


That is actually Javascript, a separate and distinct language from Java.

>..world


For further details.. <http://www.physci.org/codes/javafaq.jsp#js>

HTH

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
CK.

2005-06-06, 4:00 pm


"Andrew Thompson" <SeeMySites@www.invalid> schreef in bericht
news:1hus8l5p49zta.10rnzs5ua3u7$.dlg@40tude.net...
> On Mon, 6 Jun 2005 13:49:20 +0200, CK. wrote:
>
>
> That is actually Javascript, a separate and distinct language from Java.
>
>


Thanks for the answer,
I learned something today: Java != Javascript

Chris


Manish

2005-06-07, 3:58 am

You can split string in javascript.
ex.
function divide_string()
{
var where_is_mytool="home/mytool/mytool.cgi";
var mytool_array=where_is_mytool.split("/");
alert(mytool_array[0]+" "+mytool_array[1]+" "+mytool_array[2]);
}


Manish

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com