Hi all,
in your opinion what is better between generate JavaScript code or HTML tag from php script?
I need to change image every 10 second and i have 2 ways to do this:
1) the first is to create a long JS array and use the innerHTML every times i need to change images.
2) the second is to create a looog HTML code with all images that i need, and always with JS change the position of images content div.
So, what is the best way for the pc performans?
Reguards!
using arrays has many advantages over creating individual html elements. arrays elements are easy to read and change their values, change their order etc...
you can use a single image element and change the src using Javascript easily to display different images.
Yes, i know that. My dubt is another. In wicth memory browsers put this different information ( JS code and HTML page ) ?
I'm sure that JS code and his variables are in heap memory, but html pages where? Using a long array or scroll a long div have difference in prerformance? And this performance can be weighted with a non stop script running? I'm not looking for a easly code, i'm looking for a less expensive code.
Thanks
i think both of them are stored in heap but in different ways. its not easy to say which one is more or less expensive. depends on many other things. browser can cause major difference
Bookmarks