It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

A simple question ref Array vars into HTML <TD>

A simple question ref Array vars into HTML <TD>

Postby crazie on Sun Mar 09, 2008 1:18 pm

How can I get the program to put the returned value into a table on the same page as the original link. So far, all I have manged to achieve is to use the document.write method but this puts the value onto a fresh page and I want it in the page it was requested.

The code is as follows:

<body>
<table width="300">
<tr>
<td>
<a href="#" onmouseover="subMenu(0);">Link A</a>
</td>
<td>
<script type="text/javascript">
function subMenu(funcNum){
newFuncNum=new Array("<a href=#>Link A</a>");
return(newFuncNum[funcNum]);
}
</script>
</td>
</tr>
</table>

Just in case you are wondering why I only have one value in my array it is due to wanting to get the function to return the value before I expand the program.

As you can tell I'm kinda new to this so any help would be appreciated

Peth
crazie
 
Posts: 0
Joined: Sun Mar 09, 2008 1:12 pm

Postby rangana on Tue Mar 11, 2008 1:37 am

Yes, document.write is not a good practice since it produces 'unpredictable' outputs and overrides your page's contents.

You should be using <div> instead of tables..and when div, the easiest way is to have it display during onClick.

Hope made some sense ;)
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 3 guests