|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
||||
|
||||
|
i've been using javascript to generate a page and
show some images. but on mozilla it didn't work. usually i copy js codes, cause i really don't know javascript. so, if somebody can help, i REALLY appreciate! i'm using frames (a frame called 'Main' is where the page should be) on mozilla, the frame called 'Menu' is shown inside 'Main' frame, when i use any link with this code: Code:
function verCarta(parEndereco) {
parent.Main.document.clear();
parent.Main.document.open();
parent.Main.document.write("<html><head><link rel=stylesheet href=code/stl.css type=text/css><script type=text/javascript src=../code/db.js></script></head>");
parent.Main.document.write("<body>");
parent.Main.document.write("<div class=zonImg><img src=/"+ parEndereco +".jpg></div>");
parent.Main.document.write("<div class=dP><a href=p/"+ parEndereco +".jpg target=_blank>(181,328 x 93,839 mm)</a></div>");
parent.Main.document.write("<div class=dG><a href=g/"+ parEndereco +".jpg target=_blank>(408,517 x 211,314 mm)</a></div></body></html>");
}
|
|
#2
|
||||
|
||||
|
I played with your code a bit and produced this solution
Code:
<html>
<head>
<script>
var iframeWin, iframeElement;
var iframeId = 'myIframe';
function verCarta (parEndereco) {
var frameSrc = '';
frameSrc += '<html><head><link rel="stylesheet href=code/stl.css" type="text/css"></head>';
frameSrc += '<body>';
frameSrc += '<div class="zonImg"><img src="/'+ parEndereco +'.jpg"></div>';
frameSrc += '<div class="dP"><a href="p/'+ parEndereco +'.jpg" target="_blank">(181,328 x 93,839 mm)</a></div>';
frameSrc += '<div class="dG"><a href="g/'+ parEndereco +'.jpg" target="_blank">(408,517 x 211,314 mm)</a></div>';
frameSrc += '</body></html>';
iframeWin = window.frames.eval(iframeId);
iframeWin.document.open();
iframeWin.document.write(frameSrc);
iframeWin.document.close();
iframeElement =
document.getElementById ?
document.getElementById(iframeId) :
document.all[iframeId];
}
</script>
</head>
<body onload="verCarta('someValue');">
<iframe id="myIframe" name="myIframe" src="about:blank" width="100">
</iframe>
</body>
</html>
It seems to work in Firefox, and IE6... Notice, the variable iframeId has to match the name and id of the iframe. I hope this helps. |
|
#3
|
||||
|
||||
|
but i'm more stupid than i thought.
the real problem was the way i use the link. i was using something like this: a href='#' onClick="verCarta()" sometime after try messing the js code, i cut the 'href' and it works :P now i've got other problem, the code has two lines - the first two - wich, on IE, works clearing the frame before loading the new content. on FF it didn't works, and the content loads below the last. |
|
#4
|
||||
|
||||
|
ha! i'm REALLY stupid!
hey, i've got it:
parent.Main.document.clear(); it was all the problem :P i try 'close' instead of 'clear' and voilá! thanx anyway ![]() |
|
#5
|
||||
|
||||
|
so what does your modified code look like?
|
|
#6
|
||||
|
||||
|
Quote:
same as in the first post, but with 'close' instead of 'clear' the results are the same on IE and FF but i still don't try it on Opera or Netscape. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > javascript in mozilla |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|