PDA

View Full Version : pop up title



ggalan
01-17-2011, 06:13 PM
im trying to give titles to my pop up without success using this ... any suggestions??

button:


<a href="javascript:PopUp_1()">item 1</a>


js for pop up


function PopUp_1(){
globalHTML="<html><head><title>Something Different</title></head>"+"<frameset rows='100%,*'><frame src='"+"http://www.skidmore.edu/~hfoley/sounds/PR3s.wav"+"'></frame>"+"</frameset></html>";
window.open("javascript:opener.globalHTML","myPOPUP", features);
}

sniperman
01-19-2011, 12:54 PM
Not sure why you would need to create a framed window within a new web page, which is essentially what a pop up window is.

I would push all the code you used in JavaScript in a new web page for the pop up.


<html>
<head>
<title>Something Different</title>
</head>
<frameset rows='100%'>
<frame src='http://www.skidmore.edu/~hfoley/sounds/PR3s.wav'>
</frame>
</frameset>
</html>

and still use the same code to call the web page.


function PopUp_1() {
window.open( "newpage.html" )

I've never heard of a case where JavaScript can dynamically create a new web page other than the session you are on, so that method would not be feasible. I could be wrong.

However, on the new page, you could pass a variable to the popup window (the page title for example) and then use DOM to manipulate the Title's Attribute.

ggalan
01-20-2011, 04:37 PM
weird, this was working last night but now its not


<HTML>
<head>
<script>
var objTimer1, newOpenWindow1;
var features = 'width=400,height=250,toolbar=0,location=0,status=1,menuBar=0,scrollBars=0,resizable=0';

function PopUp_1(){
var myWindowName = 'name - 1';
var whichPage = 'someContent.html';
newOpenWindow1 = window.open(whichPage,myWindowName,features);
objTimer1 = window.setInterval("docFunc1('name - 1')", 10);
}
function docFunc1(newTitle1){
if (newOpenWindow1.document.readyState == 'complete'){
newOpenWindow1.document.title=newTitle1;
window.clearInterval(objTimer1);
}
}
</script>
</head>
<body>
<input type=button value="open window" onclick="PopUp_1()"></input>
</body>
</HTML>