![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi Guys I dont really know how to do this: if there are a page of others, some data are embedded inside the data array like this: script language="JavaScript" type="text/javascript" !-- var jsData = new Array(); jsData[0] = {bowl:"I", year:1967, winner:"Packers", winScore:35, loser:"Chiefs", losScore:10}; jsData[1] = {bowl:"II", year:1968, winner:"Packers", winScore:33, loser:"Raiders (Oakland)", losScore:14}; jsData[2] = {bowl:"III", year:1969, winner:"Jets", winScore:16, loser:"Colts (Balto)", losScore:7}; jsData[3] = {bowl:"IV", year:1970, winner:"Chiefs", winScore:23, loser:"Vikings", losScore:7}; jsData[4] = {bowl:"V", year:1971, winner:"Colts (Balto)", winScore:16, loser:"Cowboys", losScore:13}; --! Now only interested in these data,I want to export it to some format that i like ,store somewhere else, How can I do this? |
|
I know inside javascript ,you just use it's variable name to access it ,but how about out side? just like we access html elements by it's tag name, can we just use some" xpath or DOM way" to access this array? |
#3
| ||||
| ||||
|
|
script language="JavaScript" type="text/javascript" !-- var jsData = new Array(); jsData[0] = {bowl:"I", year:1967, winner:"Packers", winScore:35, loser:"Chiefs", losScore:10}; jsData[1] = {bowl:"II", year:1968, winner:"Packers", winScore:33, loser:"Raiders (Oakland)", losScore:14}; jsData[2] = {bowl:"III", year:1969, winner:"Jets", winScore:16, loser:"Colts (Balto)", losScore:7}; jsData[3] = {bowl:"IV", year:1970, winner:"Chiefs", winScore:23, loser:"Vikings", losScore:7}; jsData[4] = {bowl:"V", year:1971, winner:"Colts (Balto)", winScore:16, loser:"Cowboys", losScore:13}; |
|
--! |
|
Now only interested in these data,I want to export it to some format that i like ,store somewhere else, How can I do this? I know inside javascript ,you just use it's variable name to access it ,but how about out side? just like we access html elements by it's tag name, can we just use some" xpath or DOM way" to access this array? |
|
especially I'm using ruby(and Hpricot) to process some page content, now the choice for me is just use some regular expression to deal it like a dead string, not an array.....really appriciate if someone give me a hint |
#4
| |||
| |||
|
|
Harry wrote: script language="JavaScript" type="text/javascript" !-- var jsData = new Array(); jsData[0] = {bowl:"I", year:1967, winner:"Packers", winScore:35, loser:"Chiefs", losScore:10}; jsData[1] = {bowl:"II", year:1968, winner:"Packers", winScore:33, loser:"Raiders (Oakland)", losScore:14}; jsData[2] = {bowl:"III", year:1969, winner:"Jets", winScore:16, loser:"Colts (Balto)", losScore:7}; jsData[3] = {bowl:"IV", year:1970, winner:"Chiefs", winScore:23, loser:"Vikings", losScore:7}; jsData[4] = {bowl:"V", year:1971, winner:"Colts (Balto)", winScore:16, loser:"Cowboys", losScore:13}; var jsData = [ {bowl:"I", year:1967, winner:"Packers", winScore:35, ...}, ... }; |
#5
| |||
| |||
|
|
Thomas 'PointedEars' Lahn wrote: Harry wrote: var jsData = [ {bowl:"I", year:1967, winner:"Packers", winScore:35, ...}, ... }; Must be ]; of course. |
.![]() |
| Thread Tools | |
| Display Modes | |
| |