...

View Full Version : Input & Popup.



mie2cod
12-06-2006, 12:49 AM
Hi again everyone.

I try to restate the situation that I need with specific example below;

1) Index.html

Font1: [input name=font1 type=text] Link1

Font2: [input name=font2 type=text] Link2

Font3: [input name=font3 type=text] Link3


2) Pop.html

Arial
Courier
Times
Tahoma

- From 'Index.html', if I click 'Link 1', it will trigger 'Pop.html'. From 'Pop.html', if I click 'Arial', it will pass 'Arial' to 'font1' text input.
- if I click 'Link 2', it will trigger "the same" 'Pop.html'. From 'Pop.html', if I click 'Times', it will pass 'Times' to 'font2' text input.

The reason I need to do this is to avoid having to write '40' pop-up if I have '40' font input. Therefore, all the link will trigger "the same" pop-up. How do I do this with JS.

brandonH
12-06-2006, 03:38 PM
source code for main window:


<html>
<head>
<script language="javascript">
hiddenValue='';
function PopUP(elem){
hiddenValue=elem.previousSibling.id;
var myWin=window.open('Pop.html');
}

function writeToInput(FonT){
document.getElementById(hiddenValue).value=FonT;
}

</script>
</head>
<body>
<a href="#" onClick="newwin()">new win</a>
<input type=text name=font1 id=font1><a href="javascript:void(0);" onclick="PopUP(this);">link</a><br>
<input type=text name=font2 id=font2><a href="javascript:void(0);" onclick="PopUP(this);">link</a><br>
<input type=text name=font3 id=font3><a href="javascript:void(0);" onclick="PopUP(this);">link</a><br>
<input type=text name=font4 id=font4><a href="javascript:void(0);" onclick="PopUP(this);">link</a><br>
<input type=text name=font5 id=font5><a href="javascript:void(0);" onclick="PopUP(this);">link</a><br>
<input type=text name=font6 id=font6><a href="javascript:void(0);" onclick="PopUP(this);">link</a><br>

</body>
</html>


source code for Pop.html file:



<html>
<head>
<script type=text/javascript>
function ToOpener(FonT){
var op=opener.document?1:0;
if(op){opener.writeToInput(FonT);}
}
</script>
</head>
<body>
<a href="javascript:void(0);" onclick="ToOpener(this.innerHTML);">Arial</a><br>
<a href="javascript:void(0);" onclick="ToOpener(this.innerHTML);">Courier</a><br>
<a href="javascript:void(0);" onclick="ToOpener(this.innerHTML);">Times</a><br>
<a href="javascript:void(0);" onclick="ToOpener(this.innerHTML);">Tohoma</a><br>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum