Click to See Complete Forum and Search --> : pull a javascript variable from other page


sugar2
05-20-2005, 08:19 PM
hi
i have 2 pages, one have two javascript variables assigned, lets say...

PAGE 1:
<script>navnext = 1</script>
<script>navlen = 7</script>

PAGE2:
how can i pull the PAGE1 variable values?


note1: also my two pages are in the same domain.

note2: i know that the PASSING method using SUBMIT button works well in this cases, but the thing is that i wont pass the variable... i want to pull the variable...
only using javascript or DOM, no dinamic php either asp...

i tried to changing the context of the page like
<base href='http://mypage.domain/' target='_self'> with no results, also i need to call the same pair of variable of too many pages from the same page...

any javascrip or DOM idea?

thanks members

BigMoosie
05-20-2005, 10:08 PM
Its been a while since I have tried doing this kind of thing but if memory serves me, the one that has been opened by the other (popup) can get variables by:

window.opener.variableName;

And the one that opened the other can use:

var newWin=window.open();
newWin.variableName;

But before you do these, make a check to see if the other window even exists otherwise you will get errors if they don't.

sugar2
05-21-2005, 11:51 AM
thanks for the fast response BigMoosie, but i think i cant open like 30 windows before load my current page.. because i need to read like 30 pairs of varaibles from like 30 different pages...

to be honest i will consider recaltulate the variable values from the calling page instead of trying to call remote values...

thanks

sugar2
05-21-2005, 01:23 PM
ok, this is the panorama: i have a yah_oo-store, and i cannot use dynamic scripts inside orpduct pages, this time im doing a "Special Items page By Department", and it its a simple page with links to each page wich have special items, things become hard since, each page wich have special items have a link like : www.mypage.mydomain/department_page.html?pageNum=5, because i have a javascript dynamic pagination wich load only the items marked as "special" in the current department page
actually i have like options:

1- load the pages by iframes and then get the variable values (slown loading time)
2- create a template wich recalculate the variable values and pull it by a .js include, (daily upload)
3- recalculate the variable values inside the pulling page (hard to coding), no daily updates, once published is fast loading

thanks for the advising