PDA

View Full Version : link into frame



Stringer
05-03-2006, 11:35 PM
http://www.dynamicdrive.com/dynamicindex5/button3.htm

Please someone help a noob.

I have a 'header' frame with nav buttons. I want to default target to be the frame called 'middle'. I thought I read the instr correctly but the page does not open. I can use the buttons in parent window np.

My code:
<script type="text/javascript">
<!--
/***********************************************
* Rollover background-color button Script- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
//Specify optional button target: "_new" for new window, or name of FRAME target (ie "myframe")
var buttontarget="middle"
function change(e, color){
var el=window.event? event.srcElement: e.target
if (el.tagName=="INPUT"&&el.type=="button")
el.style.backgroundColor=color
}

function jumpto2(url){
if (buttontarget=="")
window.location=url
else if (buttontarget=="_new")
window.open(url)
else
parent[buttontarget].location=url
}
//-->
</script>

jscheuer1
05-04-2006, 05:02 AM
Are you sure your middle frame is actually named 'middle'? Ex:


<frame name="middle" src="middle_page.htm">

If so, do you have more than one frameset? The parent is the frameset immediately above the page in question, if there are frames within frames, you may need to alter the script to:


function jumpto2(url){
if (buttontarget=="")
window.location=url
else if (buttontarget=="_new")
window.open(url)
else
top.location=url
}

There are many other possibilities. It's hard to say what it is for sure, without seeing your page.

Please post a link to the page on [b]your site that contains the problematic script so we can check it out.