dynamic data in tree applet

I've got a tree applet wich I would like to use to display a database. The Database is diplaying but I can write a link to the attribute.

<param name=item1 value=dimension/specifier;;href;>

I need to write a href to the the param tag above. The href value is generated by runtime.

I'm working with Cache Weblink. Cache generates the href attribute by runtime. But it only generates them in a <a> or a <input type=SUBMIT> tag. I now need to read the href attribute from a link tag to insert it in the above shown code. how can this be achieved with javascript.
bickelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aarieCommented:
Try something like this...

----

<html>
<head>
<script language="javascript">
function GetUrl()
{
 return document.anchors[0].name;
}
</script>
</head>
<body>
<a name="MyUrl.html" href="MyUrl.html">tsjakka</a>
<br>
<script language="javascript">
document.write("<param name=item1 value=dimension/specifier;;" + GetUrl() + ";>");
</script>
</body>
</html>

------

I tested this in ns4.5 and ie5... It should work... The key here is the name attribute of the <A> tag...
if you make sure the value in the name attribute is the same as the value in the href attribute (see example, MyUrl.html), you should be okay... however, this code requires the link to be placed as the first <a> on the page...
if you can get Cache to generate the <a> tag like in my example, all should be working just fine... paste the script in the body at the location where the <param ... > should be placed.

getting the length of the anchors array can be done like so: document.anchors.length

however, this will ONLY return the number of <a>'s that have a name attribute set!!

or see http://msdn.microsoft.com/workshop/c-frame.htm#/workshop/author/dhtml/reference/objects/A.asp
for more info on this...


Arjan.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aarieCommented:
BTW, IE won't show you the result when you use view source... netscape will.. ie will execute the code though...

Arjan.
0
bickelAuthor Commented:
I'll have to have different numbers by item1 anyway so I think looping the whole thing would be the best thing to do. Since a have almost no x-perince in Javascript I would like to ask you to maybe make a example with a loop. Thanks
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

aarieCommented:
so there would be multiple parameters?? something looking like this?

<param name=item1 value=...>
<param name=item2 value=...>
....
<param name=item_n value=..>

where n would be the number of parameters...

You could make use of a loop, but then, the names of the parameters would look like item1,item2,etc... The most important thing about the loop is that the values for each parameter don't differ to much... Cause when your list of parameters would look something like

<param name=item1 value="myUrl.html">
<param name=item2 value="Roy Rogers">

then a loop would be useless....

Could you show me what the list of parameters and values looks like (in html code)?? That would make it a lot easier for me to help you out...

Arjan.
0
bickelAuthor Commented:
My list of params looks like this:

<param name="item1" value="verb;;URL1;">
<param name="item2" value="verb/instance;;URL2;">
<param name="item3" value="noun;;URL3;">

I need to dynamically insert the numbers 1,2,3,4,5,6... The place in the tree (verb, verb/instance, noun, ...) and the URLS (URL1,URL2,URL3). These URLs are generated when the page is looked at. The rest is generated when I compile, but I think it would be easyest to write it to the params the when writing the URLs.

Thanks

Lucas
0
aarieCommented:
Assuming once again that the url's are allready on the page, with preset names, say "MyUrl1","MyUrl2",..,"MyUrln"
where n is the total number of parameters which need an url in the value part.

---
<head>
....
<script language="javascript">
function GetUrl(Number)
{
 return document.anchors[Number].name;
}

ParamNamesString = "ParName1,ParName2,..,ParNamen";
ParamNames = ParamNamesString.split(",");

FixedValPartsStr = "Val1,Val2,...Valn";
FixedVal = FixedValParsStr.split(",");
</script>
....
</head>
<body>
<a href="MyUrl1" name="MyUrl1"></a>
....
<a href="MyUrln" name="MyUrln"></a>
.....
<script language="javascript">
for(i=0; i < FixedVal.length;i++)
  {
   tmp = "<param name=\"" + ParamNames[i] + "\" value=\"" + FixedVal[i];
   if( i < document.anchors.length)
     tmp += GetUrl(i);

   tmp += "\">\n";

   document.write(tmp);
  } // end for i
</script>
</body>

---------------------

Here's what you need to do to make it work...

1. Place the names of your parameters in the ParamNamesString variable, separated by commas (like above).
2. Place the fixed parts of your value parts in the FixedValPartsStr variable like with the parameters. Make sure that all parameters that require a Url come first!!
3. Have Cache generate the url's like above, including the name attribute...

That should do the trick...
If you have any problems with it let me know...

Arjan.
0
aarieCommented:
Did my proposed solution work?

Arjan.
0
bickelAuthor Commented:
I didn't try yet because the Java-tree became a lower priority in my project.

If you can wait another 1-2 weeks i'll try and you'll get the points.

thanks
 
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.