loss of target using javascript (vry annoying)

They have: 461 posts

Joined: Jul 2003

i am now using javascript to use roll overs on some pages. in one of them thre's frames. i didn't have any target in a number of the, but now there's a big issue that i'm having... namely the fact the entire page (which is actually a wide set of pages in one script) is not working at all.
it's keeps showing up as if _top was set, which actually kills the ability of the script to work correctly.

this is the first time i'm using javascript to set the target. any clue why it is overriding target? i explicitly set it for _self as welll as explicitly setting a frame on a numbe r of them, in all cases it behaves as if it was set to _top

this is VERY frustrating becasue i cannot figure out why it's giving me this behaviour. so far i have set the target in the form declaration.

ANY explanation of why i'm seeing this would be appreciated so i can get this working right

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Are you using href="url" or a Javascript method onclick? An example might help. Smiling

They have: 461 posts

Joined: Jul 2003

the control pages and forums are set up VERY similar. forums aren't in frames, and only take one hidden feild if any. not sure if there's any other differences that javascript might care about.

an example in the forums: http://24.91.157.113/findyourdesire/forums.php?tid=39

the js file i prepped everything in and keep around as a legacy: http://24.91.157.113/findyourdesire/zctest.js

the control panel function:

function subsel(form,hfld,hval){ // submit a form and set a hidden variable
  document.getElementById(hfld).value=hval;
  document.getElementById(form).submit();
  return true;
}
'as you can see there isn't much to the submit function doesn't do much aside form set hidden variables.

it's used in an onclick. since it's a rollover it the onclick is for the link that switches the images. i believe it's something like

not sure if i answered your question. i hope i did and you can explain this now

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You know, if you used a proper url in the anchor tag you would be able to use targets fine.

link

???

They have: 461 posts

Joined: Jul 2003

Suzanne wrote: You know, if you used a proper url in the anchor tag you would be able to use targets fine.

link

???

goign yo add target="_self" there thinking that's what it neeeded i noticed what is likely the problem (i'm testing that ti's the only one) when i added the links i pulled it from a diff page to just have to change three things then copy and paste to make it faster... unfortunately for that other page i needed target="_top" which i never took out. taking that out seems to right it.

either i keep spending too much time before finding the errors or sgh has disabled my ability to code :roll: Confused Mad

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

They have: 461 posts

Joined: Jul 2003

new links look somrthing like:<tr><td><a href="#" onclick="rst('cpui');" onmouseout="deselopt('reset',usr);" onmouseover="selopt('reset',usr);"><img alt="Reset!" id="reset" name="reset" src="sitepics/resetoff.png" title="I'm Static!" /></a></td><td><a href="#" onclick="subfrm('cpui');" onmouseout="deselopt('save',usr);" onmouseover="selopt('save',usr);"><img alt="Save Changes!" id="save" name="save" src="sitepics/saveoff.png" title="Save Changes!" /></a></td></tr>'

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

href="#" is really not a friendly way to code...

Is there any way you can add that in?

A return in the onclick will kill the href.

http://www.zerocattle.com/examples/popUp.html for a tangential explanation. I should really update that.

They have: 461 posts

Joined: Jul 2003

the dead url is not an issue. it's a forums, hitting cancel brings you back, and hitting back will cause the page to reload and you'll get new posts anyway.

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.