TinyPortal

Development => Block Codes => Topic started by: rbh on October 11, 2006, 04:35:26 PM

Title: a small javascript question
Post by: rbh on October 11, 2006, 04:35:26 PM
ok, i have a simple dropdown menu script i am using for loading links into an iframe. it works fine other then i would rather have a button instead of instant load for the links. i have changed various things and cannot get it to work correctly while still loading into my iframe. on the other side, i have tried various dropdown scripts with buttons and cannot get them to load into an iframe after adjusting. can someone show me what to change with this script so that links are loaded by clicking a button. i know how to put the button there, but i think something with the onchange= needs to be changed?

<form name="menu">
<SELECT onchange="window.open(this.options[this.selectedIndex].value,'MYIFRAME')">
<OPTION VALUE="myurl">
</SELECT>
</FORM>



EDIT: ok, i finally pieced together a working menu as i described. this will load target links from a dropdown menu into your iframe with a button rather then autoloading the link as the above code does.

<form name="rss">
<select name="test">
<option value="URL">LINK NAME</option>
</select> <input type="button" value="Go" onClick="parent.MYIFRAME.location.href=document.rss.test.options[document.rss.test.selectedIndex].value">
</form>


in the above snippets change the stuff in red and the parts in blue can be changed just keep them the same in all places.
Title: Re: a small javascript question
Post by: akulion on October 11, 2006, 06:22:47 PM
heres a really good one which even gives descriptions for ur links :up:
http://www.dynamicdrive.com/dynamicindex1/combodescribe.htm
Title: Re: a small javascript question
Post by: rbh on October 11, 2006, 07:33:29 PM
i think that was one i tried but couldnt get it to open the links in my iframe. i tried to target the iframe and it just opened a new window no matter what i did. i will take a crack at it again. i have nothing but time to kill lately anyways. ;D
Title: Re: a small javascript question
Post by: rbh on October 11, 2006, 08:09:48 PM
WHEW! i finally got things working. i frankensteined so many scripts till i hit the right combination. a little more cleaning and it should be good to go. this was a help topic but once i get it cleaned and working 100% i will edit my above post with the little snippet to have a dropdown menu, go button, and the links loaded into the iframe in case anyone else is in need of this. the above code right now loads links into an iframe from a dropdown menu but it is autoload, meaning once they choose a link it opens in the iframe, but what i finally got working will have the button for loading the links.
Title: Re: a small javascript question
Post by: akulion on October 12, 2006, 04:54:32 AM
good u got it worked out :up:

thanks for sharin the script - it will come in handy for sure :up:
Title: Re: a small javascript question
Post by: rbh on October 12, 2006, 05:02:12 AM
not a problem......i will add to the above, after more frustration, that if you use more then one of these menus in a block you need to change the names of each one for example

first menu
<form name="rss1">

second menu
<form name="rss2">

and make those changes in the rest of the script for the parts in blue. this is probably common knowledge for you upper crust coders but had me going crazy for awhile. ;D
Title: Re: a small javascript question
Post by: Thurnok on October 13, 2006, 12:41:38 AM
You can take a look at my Custom Page block (http://www.tinyportal.net/smf/index.php?topic=7159.msg59071#msg59071) for some info on how to do that with Javascript.  Look at the selectedChange() function for the javascript command.  It performs it via the pull down change, but you can just as easily call it via a button instead.
Title: Re: a small javascript question
Post by: me123 on May 30, 2008, 10:43:39 PM
Quote from: akubear on October 11, 2006, 06:22:47 PM
heres a really good one which even gives descriptions for ur links :up:
http://www.dynamicdrive.com/dynamicindex1/combodescribe.htm


Here is what I want to do: In the middle block, I will put the script above.(a menu appears and my visitors can select a link) OK, then I would like the link to open in my Tinyportal main window. I will uncheck the 'left block' so the page has room to open on the full width.
What code do I need for that?
Title: Re: a small javascript question
Post by: LeeD on November 26, 2008, 02:56:04 PM
hi

i see this hasnt been replied to in a bit
i have a question though regarding the drop down script

is there one definate script that works
and or do you guys prefer any 1 particuliar code

no matter which code i use , i can get them to show and drop down works , and its being directed to proper links but  hit the go button it goes nowhere - like the button is dead just clicks away
that be in IE , firefox , opera no matter what browser

any clue or help would be aprreciated

would like a drop down in a right side block