Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Jun 2007
Posts: 15
Reputation: saswati_mishra is an unknown quantity at this point 
Solved Threads: 0
saswati_mishra saswati_mishra is offline Offline
Newbie Poster

javascript table

 
0
  #1
Jun 26th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,609
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 464
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: javascript table

 
0
  #2
Jun 26th, 2007
'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.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 15
Reputation: saswati_mishra is an unknown quantity at this point 
Solved Threads: 0
saswati_mishra saswati_mishra is offline Offline
Newbie Poster

Re: javascript table

 
0
  #3
Jun 27th, 2007
Originally Posted by ~s.o.s~ View Post
'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
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 17
Reputation: Kelicula is an unknown quantity at this point 
Solved Threads: 1
Kelicula Kelicula is offline Offline
Newbie Poster

Re: javascript table

 
0
  #4
Jul 2nd, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 15
Reputation: saswati_mishra is an unknown quantity at this point 
Solved Threads: 0
saswati_mishra saswati_mishra is offline Offline
Newbie Poster

Re: javascript table

 
0
  #5
Jul 12th, 2007
Originally Posted by Kelicula View Post
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 17
Reputation: Kelicula is an unknown quantity at this point 
Solved Threads: 1
Kelicula Kelicula is offline Offline
Newbie Poster

Re: javascript table

 
0
  #6
Jul 13th, 2007
Originally Posted by saswati_mishra View Post
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC