html - JavaScript inside iframe does not work -


i have jsp iframe inside it. i'm trying load jsp in iframe:

 scripts , links ... <body> <iframe src="/contextmenu"> </iframe>  <div style="float:left;">     <div id="studenttablecontainer" style="width:70%;"></div> </div> </body> </html> 

here contextmenu:

 scripts , links ...     <body>     <div data-role="content">         <ul data-role="listview" id="listview">             <li><a href="index.html">inbox <span class="ui-li-count">12</span></a></li>             ...         </ul>     </div>     </body> 

the idea separate javascript located in first jsp , javascript located in page within iframe. can't merge javascript in 1 page (without iframe) because makes errors , page crashes. unfortunately javascript within iframe doesn't work. piece of code in <head> never calls alert:

<script>     jquery(document).ready(function () {         alert(1);         $('#listview').listview();     }); </script> 

and i'm not sure if can load js or css file that:

 <script type="text/javascript"             src="<c:url value="/resources/js/jquery.mobile-1.2.1/jquery.mobile-1.2.1.js"/>"></script> 

i'm pretty new web , javascript too, sorry if question silly. i'll appreciate help.

is <script> tag right?

<script type="text/javascript"     src="<c:url value="/resources/js/jquery.mobile-1.2.1/jquery.mobile-1.2.1.js"/>"></script> 

does c: part mean coldfusion template or that?

in case, not browser sees. whatever template code generates browser sees, that's need at. normal <script> tag in browser this:

<script src="/resources/js/jquery.mobile-1.2.1/jquery.mobile-1.2.1.js"> </script> 

(you don't need type="text/javascript".)

are familiar developer tools in browser? it's time start using them. load page in chrome , open developer tools (f12 in windows, , think it's ctrl+shift+i on other oses, or can find in chrome menu). may see error message in console panel of developer tools. (be sure reload page after open tools.)

to debug further, change code:

<script>     jquery(document).ready(function () {         alert(1);         $('#listview').listview();     }); </script> 

to:

<script>     debugger;     jquery(document).ready(function () {         debugger;         $('#listview').listview();     }); </script> 

and reload page developer tools open.

when stops on first debugger statement, roll mouse on namejquery in code. show definition of or undefined? tell whether you're loading jquery @ all.

if doesn't first debugger statement, it's not running <script> @ reason. in case developer tools should show kind of error message.

while you're doing this, take time familiar developer tools. promise multiply productivity. here's introduction devtools.


Comments