944,164 Members | Top Members by Rank

Ad:
Jun 26th, 2007
0

javascript table

Expand Post »
Hi,

I have an html page which is designed using tables. I would like to know that if I click on a button located in one cell of the table, it should open another page in a new cell of a different table without refreshing the entire page. I tried using ajax, but nothing seems to be happening.

Please help.

Thank you in advance
Saswati
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
saswati_mishra is offline Offline
15 posts
since Jun 2007
Jun 26th, 2007
0

Re: javascript table

'Doesn't work' is a very generic. You need to come up with a specific problem if you want help. There are loads of AJAX tutorials out there, just read a few of them and if you are still stuck, post your code here.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006
Jun 27th, 2007
0

Re: javascript table

Click to Expand / Collapse  Quote originally posted by ~s.o.s~ ...
'Doesn't work' is a very generic. You need to come up with a specific problem if you want help. There are loads of AJAX tutorials out there, just read a few of them and if you are still stuck, post your code here.
Hi,

I understand that very much. Let me give you a part of the code to help you understand my problem.

This is the table cell which when one clicks

<td width="33%" style="text-align: center;"> <a href="javascriptisplayAlertTable('maincontenttable','AlerttablePage.html');" id="alerts"> Alerts </a> </td>

should display the requested page in the table

<table width="100%"><div id="maincontenttable">
<tr>
<td colspan="2" width="100%" align="center"><!-- START Script Block for Chart Rotating Pie-->
<div id="RotatingPieDiv" align="center"> Dashboard appears here. </div>
<script>
var jobProgressChart = new Charts("RotatingPie.swf", "RotatingPie", width, ht, "0", "1");
jobProgressChart.setDataXML("<chart></chart>");
jobProgressChart.render("RotatingPieDiv");
</script>

<!-- END Script Block for Chart RotatingPie-->
</td>
</tr>
<tr>
<td width="80%" style="text-align:right; horizontal-align:right;" >
<Button id="ShowResourceUtilizationButton" onclick="showResourceUtilization();">Resource Utilization View </Button>
</td>
<td>
<Button id="JPViewButton" onclick="showJobProgressView();">Job Progress View </Button>
</td>
</tr></div>
</table>

and the javascript function is

/*function DisplayAlerttable(id,url)
{
var req=false;
var width = windowWidth * 0.50;
var ht = windowHeight * 0.70;
if (window.XMLHttpRequest)
{
req=new XMLHttpRequest();//for non-IE browsers
}
else if(window.ActiveXObject)//for IE
{
try
{
req=new ActiveXObject("Mxml2.XMLHttp");
}
catch(e) {
try {
req=new ActiveXObject("Microsoft.XMLHttp");
} catch(e){}
}
}
else
return false;
}
if (req)
{
req.onreadystatechange= function()
{
loadpage(id,req);

}
}
req.open(GET,"AlerttablePage.html",true);
req.send(null);
}
function loadpage(id,req)
{
if(req.readyState==4)
{
if(req.status==200)
document.ajax.dyn="Received" + req.responseText;
else document.ajax.dyn="Error:" + req.status;
}
} */

Nothing happens. Please let me know where the mistake is.

Thanks a lot in advance
Saswati
Reputation Points: 10
Solved Threads: 0
Newbie Poster
saswati_mishra is offline Offline
15 posts
since Jun 2007
Jul 2nd, 2007
0

Re: javascript table

I know this will work. Use iframes.
In the table that you want the new page to pop up (or into) place an iframe name it and you can now update it with javascript.

Like this
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <td><iframe name="theName"></iframe></td>

the in the javascript:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1.  
  2.  
  3. document.all.theName.location="the separate html file to load";

If you want the page loaded to be dynamic then you can use the write funtion of document.
ie)
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. document.all.theName.write('whatever');


iframes default to this ugly thing with scroll bars and borders, but all that can be eliminated with css, look it up. You do have google right?



Hope this helps


lemeno
Last edited by Kelicula; Jul 2nd, 2007 at 7:20 pm.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Kelicula is offline Offline
17 posts
since Jul 2007
Jul 12th, 2007
0

Re: javascript table

Click to Expand / Collapse  Quote originally posted by Kelicula ...
I know this will work. Use iframes.
In the table that you want the new page to pop up (or into) place an iframe name it and you can now update it with javascript.

Like this
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <td><iframe name="theName"></iframe></td>

the in the javascript:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1.  
  2.  
  3. document.all.theName.location="the separate html file to load";

If you want the page loaded to be dynamic then you can use the write funtion of document.
ie)
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. document.all.theName.write('whatever');


iframes default to this ugly thing with scroll bars and borders, but all that can be eliminated with css, look it up. You do have google right?



Hope this helps


lemeno

Thanks a lot. My problem is solved

Saswati
Reputation Points: 10
Solved Threads: 0
Newbie Poster
saswati_mishra is offline Offline
15 posts
since Jun 2007
Jul 13th, 2007
0

Re: javascript table

Thanks a lot. My problem is solved

Saswati

Alright!! Hey what is the link to your page, I'd like to check it out?

I may need some help with that Ajax someday.....

I'll get in touch
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Kelicula is offline Offline
17 posts
since Jul 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Smart chained select boxes
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Help with hyperlinks!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC