PROBLEEM: extern script kan selectbox niet dynamisch aanpassen
the script part is at the end of the HTML file.
HTML source
searchhidden.html
De script in externalGetInhoud is in principe goed (als ik die namelijk direct aanroep in de html source (dus daar het script in plaats) werkt alles goed). Punt is dat dit stukje script niet in de HTML source kan omdat deze source opgebouwd wordt met een server-side-progress-code bij het aanroepen ervan (dus ten tijde van de onclick event).
Foutmelding die ik krijg is:
document.getElementById('frsel') is null
Ik neem dus aan dat hij het select element niet kan vinden, wie kan me helpen? Heb het probleem al voorgelegd op andere fora, maar daar waren ze niet intelligent, hopelijk lopen hier wel handige mensen rond
the script part is at the end of the HTML file.
HTML source
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| <html> <head> // Not an important file for this function <script language="JavaScript" src="/expub/rjs/common.js"></script> </head> <body > <div id="pagebody"> <form method="post" id="frsel" name="frsel" action="/main/searchresult.html"> <table border=0> <tr> <td vallign=top align=left> <select style='width:190;height:100' size=8 id='kodlok' name='kodlok' onclick='document.frsel.kodlok.options.length=0; document.frsel.kodlok.options[0]=new Option("<%TEXT:selectall%>", "", false, false); javascript:getLoks();'> <option value=''>Geen</option> </select> </td> </tr> <td> <input type="submit" value="Zoeken >" class="buttonY100" onmouseover="this.className='buttonN100';this.parentElement.parentElement.children[0].className='formkopred'" onmouseout="this.className='buttonY100';this.parentElement.parentElement.children[0].className='formkop'"> </td> </tr> </table> </form> </div> <script language='javascript'> function getLoks() { var best = document.frsel.kodbest.options[document.frsel.kodbest.selectedIndex].value; parent.secret.location.href='/main/searchhidden.html; } </script> </body> </html> |
searchhidden.html
code:
1
2
3
4
5
6
7
8
9
10
| <html> <head> <meta http-equiv="Expires" content="0"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> </head> <script language='javascript'> document.getElementById('frsel').kodlok.options[document.getElementById('frsel').kodlok.options.length]=new Option("screenvalue1", "waarde1", false, false); </script> </html> |
De script in externalGetInhoud is in principe goed (als ik die namelijk direct aanroep in de html source (dus daar het script in plaats) werkt alles goed). Punt is dat dit stukje script niet in de HTML source kan omdat deze source opgebouwd wordt met een server-side-progress-code bij het aanroepen ervan (dus ten tijde van de onclick event).
Foutmelding die ik krijg is:
document.getElementById('frsel') is null
Ik neem dus aan dat hij het select element niet kan vinden, wie kan me helpen? Heb het probleem al voorgelegd op andere fora, maar daar waren ze niet intelligent, hopelijk lopen hier wel handige mensen rond
[ Voor 36% gewijzigd door mmniet op 17-07-2009 11:47 ]
It's me Mario