Current location: Hot Scripts Forums » General Web Coding » JavaScript » linking to iframe not working :(

linking to iframe not working :(

Reply
  #1 (permalink)  
Old 01-18-04, 03:11 PM
j0d j0d is offline
New Member
 
Join Date: Jan 2004
Location: UK , whoooooo!!!!
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy linking to iframe not working :(

my javascript is currently in one iframe in the form of an interactive menu, i need to have the menu when clicked to open in another iframe,

the frame it is in is called 'nav' ,
and the frame i wish it to be openedd into is 'main'

i hope somebody can help.

j0d
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-18-04, 03:22 PM
cshark's Avatar
cshark cshark is offline
Wannabe Coder
 
Join Date: Jan 2004
Location: Indianapolis
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
How are your targets set up?
__________________
Later
Cshark

Try <a href="http://shorthand.org">Shorthand</a>, an exciting new language for web applications.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-18-04, 03:28 PM
j0d j0d is offline
New Member
 
Join Date: Jan 2004
Location: UK , whoooooo!!!!
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by cshark
How are your targets set up?

i dont know how to do javascript but this is what i was suggested by a friend

"javascript:target='main'.href='main.html';"

i know its wrong,but thats why i need help

j0d
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-18-04, 10:27 PM
cshark's Avatar
cshark cshark is offline
Wannabe Coder
 
Join Date: Jan 2004
Location: Indianapolis
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
What if you did something like this?

<a href="whatever.htm" target="main" onClick="DoWhatever()">Hello</a>

If you're document.writing it would probably look like

<script language="javascript">

var contentxes = "<a href='whatever.htm' target='main' onClick='DoWhatever()'>Hello</a>"

document.write(contentxes)

</script>

Or am I completely missing what you're trying to do?
__________________
Later
Cshark

Try <a href="http://shorthand.org">Shorthand</a>, an exciting new language for web applications.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 01-19-04, 12:50 AM
delerium's Avatar
delerium delerium is offline
Newbie Coder
 
Join Date: Jan 2004
Location: pittsburgh
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
here ya go

this would be in the head of the page with the toolbar:

<script language="javascript">
var Content="blank.htm";
function loadContentFrame()
{
{parent.FrameName.location.href=Content;}
}
</script>

this would be in the body:

ONCLICK="loadContentFrame()"

for each different page you would need a different variable, but you could set up an array to cut down on code.

--delerium--
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 01-19-04, 09:14 PM
dmyoungemc dmyoungemc is offline
New Member
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
I am having a similar problem, but the generation of my menu system is dynamic.

Therefore, I need to simply make a change somewhere in the script to generate HTML to create a target to my iFrame.

The menu.js script looks like this -

var expanded = new Array( );
var roll_out = new Array( );
var roll_over = new Array( );
var images = new Array( );

// preload parent images
i = 0;
while ( i < parents.length ) {
images[ i ] = new Image( image_width, image_height );
images[ i ].src = parents[ i ];
i++;

images[ i ] = new Image( image_width, image_height );
images[ i ].src = parents_over[ i ];
i++;

images[ i ] = new Image( image_width, image_height );
images[ i ].src = parents_down[ i ];
i++;
}

// preload children images
for ( var j = 0; j < children.length; j++ ) {
for ( var k = 0; k < children[ j ].length; k++ ) {
images[ i ] = new Image( image_width, image_height );
images[ i ].src = children[ j ][ k ];
i++;

images[ i ] = new Image( image_width, image_height );
images[ i ].src = children_over[ j ][ k ];
i++;
}
}

function prestoChango( id, over ) {
if( document.images ) {

if ( over ) {
if ( roll_over[ id ] != "nochange" )
document[ "slot" + id ].src = ( roll_over[ id ] ? roll_over[ id ] : image_shim );
}
else {
if ( roll_out[ id ] != "nochange" )
document[ "slot" + id ].src = ( roll_out[ id ] ? roll_out[ id ] : image_shim );
}

}
}

function pullout( needle, haystack ) {
var newarray = new Array( );
var newarrayindex = 0;
for ( var i = 0; i < haystack.length; i++ )
if ( haystack[ i ] != needle )
newarray[ newarrayindex++ ] = haystack[ i ];
return newarray;
}

function inArray( needle, haystack ) {
for ( var i = 0; i < haystack.length; i++ )
if ( haystack[ i ] == needle )
return true;
return false;
}

function selMe( id ) {
if( document.images ) {

var slotcount = 0;
var parentslot = 0;
var selected = false;

for ( i = 0; slotcount < totalslots; i++ ) {

if ( parents[ i ] ) {

selected = ( children[ i ] && inArray( i, expanded ) );
nowselected = ( parentslot == id );

document[ "slot" + slotcount ].src = ( ( ( nowselected && !selected ) || ( !nowselected && selected ) ) ? parents_down[ i ] : parents[ i ] );
roll_out[ slotcount ] = ( ( ( nowselected && !selected ) || ( !nowselected && selected ) ) ? "nochange" : parents[ i ] );
roll_over[ slotcount ] = ( ( ( nowselected && !selected ) || ( !nowselected && selected ) ) ? "nochange" : parents_over[ i ] );

if ( ( nowselected ) && ( parents_urls[ i ] ) ) {

if ( parents_urls[ i ] == "popup:contact" )
window.open( "contact.php", "contact", "width=520,height=430,toolbar=no,resizable=yes,scr ollbars=yes" );
else
top.location = parents_urls[ i ];

}
else if ( ( nowselected ) && ( selected ) ) {

expanded = pullout( i, expanded );

}
else if ( ( children[ i ] ) && ( nowselected || selected ) ) {

if ( !selected )
expanded[ expanded.length ] = i;

for ( var childcount = 0; ( childcount < children[ i ].length ) && ( (slotcount+1) < totalslots ); childcount++ ) {

slotcount++;

if ( ( slotcount != parentslot ) && ( slotcount == id ) && ( children_urls[ i ][ childcount ] ) ) {

top.location = children_urls[ i ][ childcount ];


}

document[ "slot" + slotcount ].src = children[ i ][ childcount ];
roll_out[ slotcount ] = children[ i ][ childcount ];
roll_over[ slotcount ] = children_over[ i ][ childcount ];

}

}

parentslot++;
parentslot += ( selected ? children[ i ].length : 0 );
}

else {
document[ "slot" + slotcount ].src = image_shim;
roll_out[ slotcount ] = "";
roll_over[ slotcount ] = "";
}

slotcount++;
}

}
}

function printTable() {

var is_open = false;

document.writeln('<table cellspacing="0" cellpadding="0" border="0">');
for ( var i = 0, iP = 0; i < totalslots; i++, iP++ ) {
// does this parent start opened?
is_open = ( (initexpand-1) == iP );

// print parent slot & set rollovers
document.writeln('<tr><td><a href="javascript:selMe(' + i + ');" onMouseOver="prestoChango(' + i + ',true);" onMouseOut="prestoChango(' + i + ',false);"><img src="' + ( parents[ iP ] ? ( is_open ? parents_down[ iP ] : parents[ iP ] ) : image_shim ) + '" name="slot' + i + '" width=' + image_width + ' height=' + image_height + ' alt="" border="0"></a></td></tr>');
roll_out[ i ] = ( is_open ? parents_down[ iP ] : parents[ iP ] );
roll_over[ i ] = ( is_open ? parents_down[ iP ] : parents_over[ iP ] );

if ( ( is_open ) && ( children[ iP ] ) ) {
for ( var iC = 0; ( (i+1) < totalslots ) && ( iC < children[ iP ].length ); iC++ ) {
i++;
// print child slot & set rollovers
document.writeln('<tr><td><a href="javascript:selMe(' + i + ');" onMouseOver="prestoChango(' + i + ',true);" onMouseOut="prestoChango(' + i + ',false);"><img src="' + children[ iP ][ iC ] + '" name="slot' + i + '" width=' + image_width + ' height=' + image_height + ' alt="" border="0"></a></td></tr>');
roll_out[ i ] = children[ iP ][ iC ];
roll_over[ i ] = children_over[ iP ][ iC ];
}

// remember that this parent is open
expanded[ 0 ] = iP;
}

}
document.writeln('</table>');

}

The HTML file looks like this -

<head>
<title>Go Financial :: Witty Tagline</title>
<link rel="stylesheet" type="text/css" href="3balstil.css">
<script language="javascript">
<!-- php generated javascript

var totalslots = 32;
var initexpand = 0;
var image_width = 167;
var image_height = 18;
var image_shim = "nav/shim.gif";

parents = new Array( "nav/top_bit.gif", "nav/new/about_us.gif", "nav/new/consultant_program.gif", "nav/new/for_consumers.gif", "nav/new/lenders.gif", "nav/new/careers.gif", "nav/new/contact.gif" );
parents_over = new Array( "nav/top_bit.gif", "nav/new/about_us_roll.gif", "nav/new/consultant_program_roll.gif", "nav/new/for_consumers_roll.gif", "nav/new/lenders_roll.gif", "nav/new/careers_roll.gif", "nav/new/contact_roll.gif" );
parents_down = new Array( "nav/top_bit.gif", "nav/new/about_us_click.gif", "nav/new/consultant_program_click.gif", "nav/new/for_consumers_click.gif", "nav/new/lenders_click.gif", "nav/new/careers_click.gif", "nav/new/contact_click.gif" );
parents_urls = new Array( "", "", "", "", "", "", "" );

children = new Array( );
children[0] = new Array( );
children[1] = new Array( "nav/new/whatisgo.gif", "nav/new/howwedoit.gif", "nav/new/faq.gif", "nav/new/feedback.gif", "nav/new/press.gif" );
children[2] = new Array( "nav/new/programinfo.gif", "nav/new/tools.gif", "nav/new/success.gif", "nav/new/become_consultant.gif" );
children[3] = new Array( "nav/new/tools_calculators.gif", "nav/new/debt_consolidation.gif", "nav/new/creditcard.gif", "nav/new/student_loan.gif", "nav/new/consumer_success.gif", "nav/new/consumer_apply.gif" );
children[4] = new Array( "nav/new/listing.gif", "nav/new/lender_feedback.gif", "nav/new/benefits_lenders.gif", "nav/new/jointhenetwork.gif" );
children[5] = new Array( "nav/new/openings.gif", "nav/new/benefits_employees.gif", "nav/new/apply.gif" );
children[6] = new Array( "nav/new/contact_consumer.gif", "nav/new/contact_consultant.gif", "nav/new/contact_lender.gif" );

children_over = new Array( );
children_over[0] = new Array( );
children_over[1] = new Array( "nav/new/whatisgo_roll.gif", "nav/new/howwedoit_roll.gif", "nav/new/faq_roll.gif", "nav/new/feedback_roll.gif", "nav/new/press_roll.gif" );
children_over[2] = new Array( "nav/new/programinfo_roll.gif", "nav/new/tools_roll.gif", "nav/new/success_roll.gif", "nav/new/become_consultant_roll.gif" );
children_over[3] = new Array( "nav/new/tools_calculators_roll.gif", "nav/new/debt_consolidation_roll.gif", "nav/new/creditcard_roll.gif", "nav/new/student_loan_roll.gif", "nav/new/consumer_success_roll.gif", "nav/new/consumer_apply_roll.gif" );
children_over[4] = new Array( "nav/new/listing_roll.gif", "nav/new/lender_feedback_roll.gif", "nav/new/benefits_lenders_roll.gif", "nav/new/jointhenetwork_roll.gif" );
children_over[5] = new Array( "nav/new/openings_roll.gif", "nav/new/benefits_employees_roll.gif", "nav/new/apply_roll.gif" );
children_over[6] = new Array( "nav/new/contact_consumer_roll.gif", "nav/new/contact_consultant_roll.gif", "nav/new/contact_lender_roll.gif" );

children_urls = new Array( );
children_urls[0] = new Array( );
children_urls[1] = new Array( "index2.php", "then_now_so.php", "human_first.php", "tribal_meaning.php", "tribal_meaning.php" );
children_urls[2] = new Array( "where.php?worldwide", "where.php?americas", "where.php?asia%20pacific", "where.php?europe" );
children_urls[3] = new Array( "clients.php", "services.php" );
children_urls[4] = new Array( "press.php", "speaking.php" );
children_urls[5] = new Array( );
children_urls[6] = new Array( );

//-->
</script>
<script language="javascript" src="menu.js"></script>

I tried changing the children URL's, but the menu.js script did not like that.

I have no idea what to do and simply want the the menu system to open pages in a different iFrame so that I do not need to load the menu system time after time.

Also, a base href="iFrame" will not work because of the fact that there are href="#" for the times that people need to expand the menu system.

Thanks so much,

David Young
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP not working in IIS5 on WinXP Pro cistate ASP 5 06-18-04 03:31 PM
javascript popup not working???? heathercash JavaScript 2 04-27-04 04:19 AM
calendar working until months changed bitesize JavaScript 1 01-13-04 02:50 PM
Line breaks not working mdhall PHP 6 11-28-03 01:12 PM
If/else statement working...but not working mdhall PHP 13 10-16-03 09:47 AM


All times are GMT -5. The time now is 06:24 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.