SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Aug 4, 2007, 23:44 #1
- Join Date
- Jun 2007
- Posts
- 57
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
SCRIPT SRC tag not working from AJAX
I have this piece of code:
Code:<TABLE ID="weatherpane" BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="372" VALIGN="TOP" BGCOLOR="#475380"> <TR> <TD WIDTH="372" HEIGHT="43" CLASS="Basic_ARIAL_BLACK_EXTRALARGE" ALIGN="CENTER" STYLE="padding:20 0 0 0">The Weather </TD> </TR> <TR> <TD ALIGN="CENTER" STYLE="padding:8 0 20 0;"> <SCRIPT SRC='http://voap.weather.com/weather/oap/INXX0057?template=EVNTH&par=1005416873&unit=1&key=bfb3d15498a88172a8ed7720a38c102d'> </SCRIPT> </TD> </TR> </TABLE>
Thank you very much for your time!
-
Aug 5, 2007, 02:15 #2
- Join Date
- Jul 2007
- Posts
- 345
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
document.write() works when a page is being loaded. If the page is already loaded, document.write() tries to start a new document, clearing the document that is already there.
It would be okay with an object that has its own document, e.g. a frame, an iframe or a new window.
Does the weather service provide a version of the code that is not wrapped in document.write() ?
-
Aug 5, 2007, 02:30 #3
- Join Date
- Jun 2007
- Posts
- 57
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for the reply, r51.
Well, I would not think that the weather service provides such an alternative. However, I have been reading that innerHTML (that AJAX uses) does not execute scripts (i. e. javascript in this case). I think that is the problem here. Some people suggest that there are workarounds. Would you know of any?
For the time being, I used an iframe (i. e. innerHTML now outputs an iframe) to load the table above, but that table is wrapped in a DIV (which I did not provide above) with an ID that my AJAX code populates with innerHTML.
The frame works fine, but there are links in the table (which is inside the frame) that are AJAX links - i. e. when the links are clicked on, the original DIV's contents have to be updated. But the original DIV has this iframe loaded inside it, and any link which is an AJAX link will search for the DIV to send the innerHTML to inside the iframe (I think - I am yet to test that option). The code structure is like this:
Code:<DIV id="ez"> <iframe><!-- table above comes here --></iframe> </DIV>
-
Aug 5, 2007, 02:52 #4
- Join Date
- Jul 2007
- Posts
- 345
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Can you just give the iframe the id instead?
-
Aug 5, 2007, 03:26 #5
- Join Date
- Jun 2007
- Posts
- 57
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I do not think so, since there are other pieces of code loading into the DIV (when other links are clicked on) that I do not want in iframes, since search engines do not crawl iframes...
-
Aug 5, 2007, 03:42 #6
- Join Date
- Jun 2007
- Posts
- 57
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I solved the problem - it was not a pure solution that anyone else might be able to benefit from, but one specific to my case. Basically, I put just the part that had the SCRIPT SRC tag in an iframe, and so the innerHTML would output something like:
Code:<table> something </table> <iframe> something </iframe>
Thanks, r51, for your time. Have a good day.
Bookmarks