function popup(url,title){
var pop = window.open("", "p0pup",....blahblah......);
p0pup.document.open();
p0pup.document.writeln('<html><head>.......//keeps going......</body></html>');
p0pup.document.close();
}
Basically it is a popup script. My question is that is there any way to reference to an external html using document.writeln? Instead of messy html codes within document.writeln, maybe something like this?
<script language = "javascript">
function popup(url,title){
var pop = window.open("popup.html", "p0pup",....blahblah......);
p0pup.document.open();
p0pup.document.close();
p0pup.focus();
}
</script>
<input type="submit" value="submit" onClick="popup('url','title')"/>
where popup.html lives in the same directory as in index.html
However, all it pops up is a blank page...any idea why? (and...popup.html is not blank)
Last edited by MrAtheist; 05-08-2009 at 07:29 PM..
function popup(url,title){
var pop =window.open("popup.html", "p0pup",....blahblah......);
pop.focus();
}
In other words, you're trying to open p0pup while you're assigning window.open to a variable, called 'pop'.
__________________
The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.
Not sure about title... meaning not sure what you want to do with the title itself. Are we talking about calling the new window something, or do you want to alter the <title> element in the new window itself? Because I'm not sure if that can be done... url can be passed easily though... and I guess if you want to name the window itself something, you'd be doing it like so:
Code:
function popup(url,title){
var pop = window.open(url, title,....blahblah......);
pop.focus();
}
Make sure you pass url and title as strings when calling the function. I.e:
Code:
popup("popup.html","p0pup");
See how that goes for you.
__________________
The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.