| Coding Forum Problems with your code? Let's hear about it. |
11-03-2006, 07:02 AM
|
#1 (permalink)
|
|
Inactive
Join Date: 10-25-06
Posts: 4
Latest Blog: None
|
div like frame
is it possible to make pages load in specified div...(i know I can do it in frames but I dont if its possible in "div"?)If yes ,then how?? 
|
|
|
11-03-2006, 07:51 AM
|
#2 (permalink)
|
|
Contributing Member
Join Date: 10-14-03
Location: Top left of England, UK
Posts: 243
Latest Blog: None
|
I've never tried, but I'm thinking in theory it might be possible to replicate the function of an iFrame, using AJAX and PHP.
- You'd trigger an AJAX call via a button or whatever
- The AJAX would call a PHP script with the URL to receive
- The PHP script would do an include() on the URL
- This would return to the AJAX
- The AJAX Javascript would use getElementById('x').innerHTML to update the DIV
As I say, I've not tried it and there could be problems such as the remote page having <html> and <body> tags which might mess things up, but if you could control the remote page then I guess it would work....maybe.
Only just thought up this solution however so no doubt there's a big bug in it somewhere.
Trev
|
|
|
11-03-2006, 07:57 AM
|
#3 (permalink)
|
|
Empress™
Join Date: 08-19-04
Location: York, UK
Posts: 17,965
|
Or if you're set on using frames, you can use an iframe.
|
|
|
11-03-2006, 07:58 AM
|
#4 (permalink)
|
|
Inactive
Join Date: 03-29-06
Posts: 546
|
If you want to do it simply - use a IFRAME.
Otherwise you are looking at AJAX, and even then its only a "subpage" and not a full page (ie you cant let the page have its own style sheets, javascript, title etc)
|
|
|
11-03-2006, 08:00 AM
|
#5 (permalink)
|
|
Empress™
Join Date: 08-19-04
Location: York, UK
Posts: 17,965
|
One minute too late! 
|
|
|
11-03-2006, 09:01 AM
|
#6 (permalink)
|
|
Inactive
Join Date: 03-29-06
Posts: 546
|
But you give the 5p answer - I get full points for mine :p
|
|
|
11-03-2006, 11:28 AM
|
#7 (permalink)
|
|
v7n Mentor
Join Date: 02-18-04
Location: Minneapolis, Minnesota
Posts: 1,940
|
You have to target the correct layer. Here is a quick example on how the logic works. You will have to customize it to fit your needs.
Code:
<script language="JavaScript" type="text/JavaScript">
<!--
function WriteLayer(ID,parentID,sText) {
if (document.layers) {
var oLayer;
if(parentID){
oLayer = eval('document.' + parentID + '.document.' + ID + '.document');
}else{
oLayer = document.layers[ID].document;
}
oLayer.open();
oLayer.write(sText);
oLayer.close();
}
else if (parseInt(navigator.appVersion)>=5&&navigator.
appName=="Netscape") {
document.getElementById(ID).innerHTML = sText;
}
else if (document.all) document.all[ID].innerHTML = sText
}
//-->
</script>
<p><A href="#"onclick="WriteLayer('MyLayer',null,Date())">Write to layer</A> </p>
<div id="MyLayer" style="position:absolute; left:50px; top:71px; width:434px; height:203px; z-index:1; background-color: #99FFFF; layer-background-color: #99FFFF; border: 1px none #000000;"></div>
|
|
|
11-03-2006, 05:27 PM
|
#8 (permalink)
|
|
Inactive
Join Date: 10-25-06
Posts: 4
Latest Blog: None
|
[quote=imaginemn;488625]You have to target the correct layer. Here is a quick example on how the logic works. You will have to customize it to fit your needs.
looks good  but can you make some adnotations to the java script part?? especialy witch parts I can modify??I'm not familiar with js. apart from using it 
but anyway VERY BIG THANKS  ) 
|
|
|
11-03-2006, 05:36 PM
|
#9 (permalink)
|
|
Inactive
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
Latest Blog: None
|
This is the single feature I miss most about "layers" (remember them?) You could swap out the source. Has anyone ever tried to float an iframe? Not gonna happen unless its also on a div. Layers were so simple, but divs won the day. Too bad we couldn't have kept both. <sigh>
|
|
|
11-03-2006, 10:42 PM
|
#10 (permalink)
|
|
v7n Mentor
Join Date: 02-18-04
Location: Minneapolis, Minnesota
Posts: 1,940
|
try this
Code:
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function WriteLayer(ID,parentID,sText) {
if (document.layers) {
var oLayer;
if(parentID){
oLayer = eval('document.' + parentID + '.document.' + ID + '.document');
}else{
oLayer = document.layers[ID].document;
}
oLayer.open();
oLayer.write(sText);
oLayer.close();
}
else if (parseInt(navigator.appVersion)>=5&&navigator.
appName=="Netscape") {
document.getElementById(ID).innerHTML = sText;
}
else if (document.all) document.all[ID].innerHTML = sText
}
var copy1 = "<font face='arial' size='2'>hello, I am <B>copy1</B></font>"
var copy2 = "<font face='arial' size='2'>hello, I am <B>copy2</B></font>"
//-->
</script>
<p><A href="#" onclick="WriteLayer('MyLayer',null,copy1)">copy 1</A> </p>
<p><A href="#" onclick="WriteLayer('MyLayer',null,copy2)">copy 2</A> </p>
<div id="MyLayer" style="position:absolute; left:41px; top:98px; width:434px; height:203px; z-index:1; background-color: #99FFFF; layer-background-color: #99FFFF; border: 1px none #000000;"></div>
|
|
|
11-04-2006, 05:14 AM
|
#11 (permalink)
|
|
Inactive
Join Date: 10-25-06
Posts: 4
Latest Blog: None
|
You're amazing  ))thx!!!! 
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 08:47 PM.
© Copyright 2008 V7 Inc
|