• Das Erstellen neuer Accounts wurde ausgesetzt. Bei berechtigtem Interesse bitte Kontaktaufnahme über die üblichen Wege. Beste Grüße der Admin

URL aus Pop-Up in Textfeld im Ursprungsfenster

Tschiwek

New member
Hallo,
was ich meine ist:
Angenommen ich habe ein Formular mit einem Textfeld für eine URL. Jetzt wil ich ein Script schreiben, das auf Knopfdruck ein neues Fenster öffnet. Das Fenster soll aus zwei Frames bestehen im unteren der Normale Inhalt, oben eine Zeile für eine URL, die unten angezeitgt wird (soweit alles für mich klar).
ABER:
Oben soll auch ein Knopf sein, der - osbald er gedrückt wird - die aktuell im unteren Frame angewählte URl in das ursprüngliche Textfeld einträgt? klar, was ich meine?

Vielleicht ein Beispiel:
BEsucher(B) klickt auf ersten Knopf. Es öffnet sich ein Pop-Up. Er trägt oben die URL test.de ein. Jetzt surft er ein wenig darauf rum und landet bei test.de/lala.htm. Drückt er jetzt den anderen Knopf, schließt das Pop-Up und im Ursprungsfenster erscheint im TExtfeld test.de/lala.htm

Wäre froh, wenn mir einer sagen könnte, wie das Geht..

Danke
 
Sorry, aber da würde ich selber den ganzen Tag dransitzen. Einen Tip, welches Daten in das "creator.document" gibt, kannste haben. Willste?

greets
 
Gerne

Klar, ich wusste halt gar nicht, ob JS dafür das richtige ist. Normalerweise schreibe ich alles in PHP, doch da bin ich dann an meine Grenzen gestoßen. Mit JS kenne ich mich (noch) nicht so sehr aus.
Deshalb bin ich für jeden Tipp dankbar :)
 
Das ist jetzt viel Text. Resultat ist eine Liste, deren Inhalt man in einem kleinem PopUp ändern kann. Also klickt man im PopUp auf speichern, werden die Daten an das creator - Window gegeben.
Studiere das Script am besten mal, nachdem du es eingebaut hast. ( oder andersrum )

--- creator.htm ---

<html>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Pankaj Mittal (pankajm@writeme.com) -->
<!-- Web Site: http://www.fortunecity.com/lavendar/lavender/21 -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function small_window(myurl) {
var newWindow;
var props = 'scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=300,height=200';
newWindow = window.open(myurl, "Add_from_Src_to_Dest", props);
}
// Adds the list of selected items selected in the child
// window to its list. It is called by child window to do so.
function addToParentList(sourceList) {
destinationList = window.document.forms[0].parentList;
for(var count = destinationList.options.length - 1; count >= 0; count--) {
destinationList.options[count] = null;
}
for(var i = 0; i < sourceList.options.length; i++) {
if (sourceList.options != null)
destinationList.options = new Option(sourceList.options.text, sourceList.options.value );
}
}
// Marks all the items as selected for the submit button.
function selectList(sourceList) {
sourceList = window.document.forms[0].parentList;
for(var i = 0; i < sourceList.options.length; i++) {
if (sourceList.options != null)
sourceList.options.selected = true;
}
return true;
}

// Deletes the selected items of supplied list.
function deleteSelectedItemsFromList(sourceList) {
var maxCnt = sourceList.options.length;
for(var i = maxCnt - 1; i >= 0; i--) {
if ((sourceList.options != null) && (sourceList.options.selected == true)) {
sourceList.options = null;
}
}
}
// End -->
</script>

<script>
function doit(s)
{
alert ("Here is your file:\n"+s);
}
</script>

</HEAD>
<body>
<center>
<form method=post>
<table border=1 bgcolor="#ffffcc">
<tr>
<td>
<select size=5 name=parentList multiple>
</select>
</td>
</tr>
<tr>
<td align=center>
<input type=button value="Add Item" onclick = "javascript:small_window('modify.htm');">
<input type=button value="Delete Item" onclick = "javascript:deleteSelectedItemsFromList(parentList);">
</td>
</tr>
</table>
</form>
</center>
<a href="javascript:eek:D.startDownload('file:///c:/test.htm', setTimeout('doit()', 10000))" ID="oD" STYLE="behavior:url(#default#download)">klickit</a>
<p>
</body>
</html>

-----

---- modify.htm -----


<html>
<head>
<script language="JavaScript">
Begin
<!--
// Add the selected items in the parent by calling method of parent
function addSelectedItemsToParent() {
self.opener.addToParentList(window.document.forms[0].destList);
window.close();
}
// Fill the selcted item list with the items already present in parent.
function fillInitialDestList() {
var destList = window.document.forms[0].destList;
var srcList = self.opener.window.document.forms[0].parentList;
for (var count = destList.options.length - 1; count >= 0; count--) {
destList.options[count] = null;
}
for(var i = 0; i < srcList.options.length; i++) {
if (srcList.options != null)
destList.options = new Option(srcList.options.text);
}
}
// Add the selected items from the source to destination list
function addSrcToDestList() {
destList = window.document.forms[0].destList;
srcList = window.document.forms[0].srcList;
var len = destList.length;
for(var i = 0; i < srcList.length; i++) {
if ((srcList.options != null) && (srcList.options.selected)) {
//Check if this value already exist in the destList or not
//if not then add it otherwise do not add it.
var found = false;
for(var count = 0; count < len; count++) {
if (destList.options[count] != null) {
if (srcList.options.text == destList.options[count].text) {
found = true;
break;
}
}
}
if (found != true) {
destList.options[len] = new Option(srcList.options.text);
len++;
}
}
}
}
// Deletes from the destination list.
function deleteFromDestList() {
var destList = window.document.forms[0].destList;
var len = destList.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((destList.options != null) && (destList.options.selected == true)) {
destList.options = null;
}
}
}
// End -->
</SCRIPT>
</head>
<body onLoad="javascript:fillInitialDestList();">
<center>
<form method="POST">
<table bgcolor="#FFFFCC">
<tr>
<td bgcolor="#FFFFCC" width="74">Available</td>
<td bgcolor="#FFFFCC"> </td>
<td bgcolor="#FFFFCC" width="69">Selected</td>
</tr>
<tr>
<td bgcolor="#FFFFCC" width="85">
<select size="6" name="srcList" multiple>
<option value="1">Item 1
<option value="2">Item 2
<option value="3">Item 3
<option value="4">Item 4
<option value="5">Item 5
<option value="6">Item 6
</select>
</td>
<td bgcolor="#FFFFCC" width="74" align="center">
<input type="button" value=" >> " onClick="javascript:addSrcToDestList()">
<br><br>
<input type="button" value=" << " onclick="javascript:deleteFromDestList();">
</td>
<td bgcolor="#FFFFCC" width="69">
<select size="6" name="destList" multiple>
</select>
</td>
</tr>
<tr>
<td colspan=3 align="center">
<input type="button" value="Done" onClick = "javascript:addSelectedItemsToParent()">
</td>
</tr>
</table>
</form>
</center></body>
</html>

------------

@(hoffe das ist nicht zuviel text)
greets
 
Ok

hier dann no das um den Pfad anzuzeigen.


auch BreadCrumps genannt ....


<script language="javascript">

var path = "";
var href=document.location.href;
var s=href.split("/");
for (var i=2;i<(s.length-1);i++) {
path+="<A HREF=\""+href.substring(0,href.indexOf(s)+s.length)+"/\">"+s+"</A> / ";
}
i=s.length-1;path+="<A HREF=\""+href.substring(0,href.indexOf(s)+s.length)+"\">"+s+"</A>";
var url = window.location.protocol + "//" + path;
document.writeln(url);

</script>




Meine Seite www.1Times.de
 
Zurück
Oben