/    Sign up×
Community /Pin to ProfileBookmark

targeting drop down menus to inline frames

i want to target my drop down menu links to a inline frame on the same page here is my script for one of my drop down menus currently targetting to a new window

I have not yet made the pages that will go inside the iframe but have got names for them;

<select onchange=”if (this.selectedIndex > 0) window.open(this.value);”>
<option selected=”selected”>general</option>
<option value=””>home</option>
<option value=””>news</option>
<option value=””>tour</option>
<option value=””>site</option>
<option value=””>email</option>
</select>

what do i need to change at the top for it to open into the iframe?

Thanks

Miles

to post a comment
JavaScript

12 Comments(s)

Copy linkTweet thisAlerts:
@VladdyJun 16.2004 — Select element is used in forms not for site navigation.

Frames are used .... never mind, they are no longer used.

You need to bring your knowledge of web development up to date before going any further.
Copy linkTweet thisAlerts:
@MilesauthorJun 16.2004 — im using this for advice to increase my knowledge
Copy linkTweet thisAlerts:
@PittimannJun 16.2004 — Hi!

replace:

window.open(this.value)

with:

document.getElementById('IdOfYourIframe').src=this.value

Cheers - Pit
Copy linkTweet thisAlerts:
@MilesauthorJun 16.2004 — cheers that was more helpful!

Miles
Copy linkTweet thisAlerts:
@PittimannJun 16.2004 — Hi!

You're welcome! ?

Cheers - Pit
Copy linkTweet thisAlerts:
@MilesauthorJun 16.2004 — Thanks however have tried it and i cnat seem to get it to work!

Is there another way or is there something iposibbly have done wrong?


home.htm is the only page i have got so far!

<select onchange="if (this.selectedIndex > 0) document.getElementById('IdOfYourIframe').src=this.value;">

<option selected="selected">general</option>

<option value="home.htm">home</option>

<option value="">news</option>

<option value="">tour</option>

<option value="">site</option>

<option value="">email</option>

</select>

Thanks

Miles
Copy linkTweet thisAlerts:
@PittimannJun 16.2004 — Hi!

Your iframe will need an id like 'IdOfYourIframe':

<frame id='IdOfYourIframe'></iframe>

I thought it already had one and you would replace 'IdOfYourIframe' with the id, your iframe actually has.

Hope that helps.

Cheers - Pit
Copy linkTweet thisAlerts:
@MilesauthorJun 16.2004 — thats quality

cheers mate

one last thing do you know much about drop down menus?

if you do what can i do to make the 'general' part the title of the menu so once i click to go to one page it goes back to general in the menu?

<select onchange="if (this.selectedIndex > 0) document.getElementById('iframe').src=this.value;">

<option selected="selected">general</option><option value="home.htm">home</option><option value="">news</option><option value="">tour</option><option value="">site</option><option value="">email</option>

</select>


Understand?

Thanks

Miles
Copy linkTweet thisAlerts:
@PittimannJun 16.2004 — Hi!

<select onchange="if (this.selectedIndex > 0) document.getElementById('iframe').src=this.value;this.selectedIndex=0;">

Cheers - Pit
Copy linkTweet thisAlerts:
@MilesauthorJun 16.2004 — thanks so much

Miles
Copy linkTweet thisAlerts:
@PittimannJun 16.2004 — Hi!

You're welcome! ?

Cheers - Pit
Copy linkTweet thisAlerts:
@mwiggin1Jun 16.2004 — [i]Originally posted by Vladdy [/i]

[B]You need to bring your knowledge of web development up to date before going any further. [/B][/QUOTE]


I thought that's what this site was for ...
×

Success!

Help @Miles spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...