Click to See Complete Forum and Search --> : Whats wrong w/this outer html?
msimmons
Nov 26th, 2001, 02:56 PM
I am using hidden frames and outer html to display some items from a database and have done so sucessfully in the past. I am displaying a row of names down a sidebar but only have room for 7 so if I have more than that I am adding a "more names" link at the bottom like this:
·Michael
·Ralph
·john
·barbara
·Pat
·Archie
·Jughead
more names 1 [2] [3]
I have made [2] & [3] javascript links like this:
<div id="block_MoreNames" align="left">More Names: 1 <a href="javascript:sideChange('2')">[2]</a></div>
that calls this function:
function sideChange(newVar){
window.open('name_change.asp?Mode=ChangeSide&name=' + newVar , 'DoStealth');
}
in that page I (via ASP) build this javacript code (whole 'DoStealth' page pasted here:
<html>
<body bgcolor="#666666" text="#ffffff">
<script>
with (parent.frames[2].document.all){
bullet1.outerhtml = '<div id="bullet1">·</div>';
block_name1.outerhtml = '<div id="block_name1" onClick="nameChange(\'8\')">George</div>';
bullet2.outerhtml = '<div id="bullet2">·</div>';
block_name2.outerhtml = '<div id="block_name2" onClick="nameChange(\'9\')">Dave</div>';
bullet3.outerhtml = '<div id="bullet3">·</div>';
block_name3.outerhtml = '<div id="block_name3" onClick="nameChange(\'10\')">Adam</div>';
bullet4.outerhtml = '<div id="bullet4">·</div>';
block_name4.outerhtml = '<div id="block_name4" onClick="nameChange(\'11\')">Nikki</div>';
bullet5.outerhtml = '<div id="bullet5">·</div>';
block_name5.outerhtml = '<div id="block_name5" onClick="nameChange(\'12\')">Shanna</div>';
}
</script>
</body>
</html>
But... it dosen't change anything... I am bewildered, unbemused, and just plain stuck. I use outer html extensivly throught the app and cannot see why this isnt working. (probably something really simple :))
Thanks in advance,
Michael
progressive
Nov 27th, 2001, 04:47 AM
Try this !
<div id="block_MoreNames" align="left">More Names: 1 <a href="java script:window.top.sideChange('2')">[2]</a></div>
//put this function in the page that contains the frames
function sideChange(newVar){
window.open('name_change.asp?Mode=ChangeSide&name=' + newVar , 'DoStealth');
}
<html>
<body bgcolor="#666666" text="#ffffff">
<script>
with (window.opener.parent.frames[2].document.all){
bullet1.outerhtml = '<div id="bullet1">·</div>';
block_name1.outerhtml = '<div id="block_name1" onClick="nameChange('8')">George</div>';
bullet2.outerhtml = '<div id="bullet2">·</div>';
block_name2.outerhtml = '<div id="block_name2" onClick="nameChange('9')">Dave</div>';
bullet3.outerhtml = '<div id="bullet3">·</div>';
block_name3.outerhtml = '<div id="block_name3" onClick="nameChange('10')">Adam</div>';
bullet4.outerhtml = '<div id="bullet4">·</div>';
block_name4.outerhtml = '<div id="block_name4" onClick="nameChange('11')">Nikki</div>';
bullet5.outerhtml = '<div id="bullet5">·</div>';
block_name5.outerhtml = '<div id="block_name5" onClick="nameChange('12')">Shanna</div>';
}
</script>
</body>
</html>
msimmons
Nov 27th, 2001, 10:27 AM
moving the function woulden't change anything, the name_change.asp is still being opened in the frame. I tried throwing in a outer html call to another element on the page and that worked fine... so my guess is that it is in the names that I want to change from somehow.
this code is dynamicly built via asp:
<div id="bullet1">·</div>
<div id="block_name1" onClick="nameChange('1')">Mike</div>
<div id="bullet2">·</div>
<div id="block_name2" onClick="nameChange('2')">George</div>
<div id="bullet3">·</div>
<div id="block_name3" onClick="nameChange('3')">Ralph</div>
<div id="bullet4">·</div>
<div id="block_name4" onClick="nameChange('4')">Pat</div>
<div id="bullet5">·</div>
<div id="block_name5" onClick="nameChange('5')">Sam</div>
<div id="bullet6">·</div>
<div id="block_name6" onClick="nameChange('6')">Tasha</div>
<div id="bullet7">·</div>
<div id="block_name7" onClick="nameChange('7')">Earl</div>
<div id="block_Morenames" align="left">More names: 1 <a href="javascript:sideChange('2')">2</a></div>
thanks in advance,
Michael
progressive
Nov 27th, 2001, 10:30 AM
according to your post name_change.asp is being opened in a new window
function sideChange(newVar){
window.open('name_change.asp?Mode=ChangeSide&name=' + newVar , 'DoStealth');
}
msimmons
Nov 27th, 2001, 10:32 AM
its a frame (frame4 in the array) called DoStealth that is hidden that I use for my outer html calls
michael
progressive
Nov 27th, 2001, 10:41 AM
ah I see now!
I read somewhere that the outerhtml method doesn't work until the whole page has loaded. try sticking it in an onload event eg!
<html>
<script>
function setDivs(){
with (parent.frames[2].document.all){
bullet1.outerhtml = '<div id="bullet1">·</div>';
block_name1.outerhtml = '<div id="block_name1" onClick="nameChange('8')">George</div>';
bullet2.outerhtml = '<div id="bullet2">·</div>';
block_name2.outerhtml = '<div id="block_name2" onClick="nameChange('9')">Dave</div>';
bullet3.outerhtml = '<div id="bullet3">·</div>';
block_name3.outerhtml = '<div id="block_name3" onClick="nameChange('10')">Adam</div>';
bullet4.outerhtml = '<div id="bullet4">·</div>';
block_name4.outerhtml = '<div id="block_name4" onClick="nameChange('11')">Nikki</div>';
bullet5.outerhtml = '<div id="bullet5">·</div>';
block_name5.outerhtml = '<div id="block_name5" onClick="nameChange('12')">Shanna</div>';
}
}
</script>
<body bgcolor="#666666" onload="setTimeout('setDivs()',100)" text="#ffffff">
</body>
</html>
I put it in a setTimeout just to make sure!
try that ;)
msimmons
Nov 27th, 2001, 11:02 AM
I'm angry and elated at the same time... you know what was wrong??? i had:
element.outerhtml
see the problem? nether do I... ready to be shocked?
the answer is.....
element.outerHTML
I spent a whole day on this...
thanks for all the help, sorry to waste your time :)
Michael
progressive
Nov 27th, 2001, 11:08 AM
Don't you just hate it when that happens!
Don't worry your not alone in your anger and frustration it happens to us all!
Youv'e not wasted my time as I've learned something new anyway because I didn't know about outerHTML. I only knew about innerHTML.
Suerly this won't work in netscape though!
msimmons
Nov 27th, 2001, 11:14 AM
I love outer html and use it all the time... my fav thing is to create a page with atleast two frames and have one set to 100% and the other to * (or any configuration... as long as one is hidden... at design time I set the % to 95 so I can see what is happening though) I just do all the processing in the 'dostealth' frame and never refresh the other. Outer html and tables don't get along to well though so you have to play with that abit. and no, I dont think Netscape supports it... not sure if they have their own version, but I am lucky enough to beable to program where I can tell my users "Use MSIE or else" :)
thanks
michael
progressive
Nov 27th, 2001, 11:18 AM
Why can you tell your users to use MSIE or else?
msimmons
Nov 27th, 2001, 11:22 AM
Because my boss lets me :)
Apperantly the programmer before me convinced him that we can just do better apps that only work for msie so we just tell our clients to use our programs you must use msie
michael
progressive
Nov 27th, 2001, 11:24 AM
The guy before you was a clever guy..:)
So what is it you do?
msimmons
Nov 27th, 2001, 11:28 AM
the actual business side I'm not all that clear on (don't care enough to learn, i just learn enough to know what my programs need to do) but I build ways for hotels to manage booking type stuff online... my latest projects are inhouse though like accounting software but internet based.
michael
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.