Jump to content


Photo

Java conflict question


  • Please log in to reply
3 replies to this topic

#1 mcmuney

mcmuney

    Advanced Member

  • Members
  • PipPipPip
  • 355 posts

Posted 02 February 2013 - 04:42 AM

I have a scenario where the javascript stops working once a section of a page is reloaded. For example:

<javascript>
some java code to open an image usina a fancy window
</script
<div id="reload_section">
<a href="image" id="java-fancy-window" onclick="java-fancy-windo"><img src="image"></a>
</div>
<a href="reload_section_page">RELOAD SECTION</a>


I'm using something like this and when I click on the image, it opens the image in a nice popup window; however, when the <div> section is reloaded, the same function stops to work. I've even tried placing the java code again inside the page that's reloaded inside the <div>, but it still does not work.

Any ideas?

Edited by mcmuney, 02 February 2013 - 04:43 AM.


#2 requinix

requinix

    Transforming Moderator

  • Moderators
  • 6,133 posts
  • LocationWA

Posted 02 February 2013 - 05:46 AM

What do you mean by "reload"? Are you destroying and/or recreating the a#java-fancy-window? It'll lose the onclick event you have written there inline.

#3 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 02 February 2013 - 10:36 AM

For the record, java is not Javascript. Two different things.

Are you loading the page via AJAX?
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#4 mcmuney

mcmuney

    Advanced Member

  • Members
  • PipPipPip
  • 355 posts

Posted 02 February 2013 - 04:03 PM

Yes, I'm reloading the <div> section via ajax, which loads a new image. But after a reload, the image load on the fancybox stops working, even though the java is outside of the <div> that's reloading withing the page.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com