...

View Full Version : popup + input (need some help)



netmaniak
07-11-2004, 11:21 PM
i've got the problem ! can't find any same script that can do the following:
there is an <input> text field on the site ... i create a popup window that lists some RSS feeds from the sites ! (made on PHP) ...and the sctipt must do the this : when you click on the link the URL of RSS inserts into the <input> field ...please help ! any materials (functions,exapmles) are WELCOME !!!

jamescover
07-12-2004, 12:00 AM
<form name="mForm">
<input name="rssLoc" type="text" size="35" />
<input name="mBut" type="button" value="getLoc" onClick="javascript:mForm.rssLoc.value=window.location;" />
</form>


-james

netmaniak
07-12-2004, 01:47 AM
great thx a lot ! you really helped !

may be you know how to read not the value=window.location; but the value of for example the value of HREF ! : <a href="http://www.somesite.com/rss.xml>RSS</a>

jamescover
07-12-2004, 02:06 AM
I'm not sure what you're asking, but I think you're talking about something like this:


<script>
<!--

href=window.location.href;
rss = href.substring(href.lastIndexOf('/')+1);
function getRSS(){
mForm.rssLoc.value=rss;
}

//-->
</script>


<form name="mForm">
<input name="rssLoc" type="text" size="35">
<input name="mBut" type="button" value="getLoc" onClick="javascript:getRSS();"> </form>


You can just change the following line to suit:

rss = href.substring(href.lastIndexOf('/')+1);

The above will give you one character past the last "/". But you can do +2, +3, etc. Or -1, -2, etc. Or you can do last index of '.' or '//' etc.


-james

netmaniak
07-12-2004, 02:38 AM
i really sorry for my bad english !! i'll try to explane from the "0 %"

so i have an <input> field on the 1st window ! near this field there is a link to another window wich i'll create by popup function of JS ! in the 2nd window (popup widnow) there are a lot of links to RSS feeds of sites ! when user click on the link it will automatically appear in the <input> of 1st window !!! (the 2nd problem is that when the user clicked on the link NONE window must appear, only the value of link must be copied to the <input> area in 1st widnow , i've read the it's possible to do by <A HREF="javascript:void(0)">RSS FEED LINK</A>!) ... i hope the situation will be cleared for you

netmaniak
07-12-2004, 02:38 AM
i've found some example but it was only calendar + color select scripts

jamescover
07-12-2004, 04:42 AM
If I understand your question, using the first form I posted, put this in the popup:


<a href="#" onClick="javascript:window.opener.document.mForm.rssLoc.value=opener.window.location;return false;">A LINK</a>



-james

glenngv
07-12-2004, 07:05 AM
function setRSS(rssURL){
if (opener && !opener.closed) { //make sure the opener window is still open
opener.document.theForm.theField.value = rssURL;
opener.focus();
}
window.close(); //close popup
return false;
}
...
<a href="http://www.somesite.com/rss1.xml" onclick="return setRSS(this.href)">RSS FEED LINK 1</a>
<a href="http://www.somesite.com/rss2.xml" onclick="return setRSS(this.href)">RSS FEED LINK 2</a>
<a href="http://www.somesite.com/rss3.xml" onclick="return setRSS(this.href)">RSS FEED LINK 3</a>
...

netmaniak
07-12-2004, 11:04 AM
thx a lot for help ! great respect to all !!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum