Jump to content
The Uniform Server Community
Heinz Stapff

External.js has no effect on div echo file.php html

Recommended Posts

OK. I had set up an Iframes test site and then changed the frames to divs for UniServer/www/index.html, hopping that creating seperate html files would make it easier to create php files to call onclick of li elements from external.js files that change the div.innerHTML with mysql_query.

The onclick of the query works and the div.innerHTML changes as httpresponce echo file.php, producing the desired html elements in the div The external CSS presents the change perfectly. Unfortunatley the external.js no longer has power over the elements produced by the query. I checked the view source on the page and found that it remained the same and did not reveal the div content change which might mean I can't grab the element values that I need to manipulate the query result html elements.

I realize now that the connection was closed at the end of the query so the elements must be there along with their values even if they don't show up in view source? :rolleyes:

 

External.js Example part of same js that called mysql_query

function pictureclick( ) {
var f1=document.getElementById('f1');//div changed by mysql_query
var pictures=f1.getElementsByTagName('img');//tags created by mysql_query
var iObj=pictures;
for(var i=0; i<iObj.length; i++) {
iObj[i].onclick=function( ) { enhance(this);};
}
};

function enhance(img){
var icell = img.parentNode.parentNode;//accessable in standard html
var pref = icell.getElementsByTagName('input')[2].value;
f1.innerHTML = "<img src='"+pref+"' id='eimage'align='center' style='height:100%; width:auto;'/>   <button id='imgbt' style='position:fixed; top:78%; left:80%; z-index:100;'>Continue Shopping</button>";
alert(pref);//produces ..../file.jpg in standard html not in echo php div content?
}

addEvent(window,'load',function( ){ 
var alreadyrun = false;
if(alreadyrun) {
return;
}
alreadyrun=true;
f1class( );//already acctivated on index.html load
},false); addtocart( );pictureclick( );//addtocart dosen't work on the query result elements either

 

I'm wondering if this occurs because of the browser change in UniServer and my .js isn't a good cross browser solution though I've taken a lot of care to make it so. :) Any advise Greatly appreciated!

Share this post


Link to post
Share on other sites

And this has to do with PHP.... how? This actually belongs under Programming & Web Design. It's NOT a Uniform Server-related problem, so I'm moving the topic.

 

Remember, Javascript runs on the client's browser, not on the server.

There is no browser associated with UniServer.

 

It seems to me that you need to build a chart that shows just where and when the elements are created, transferred, and then acted upon.

 

Regards,

BobS

Share this post


Link to post
Share on other sites

BobS Thanks , I wasn't sure that it was a php problem but I'm guessing it might be mybrowser when running the loaded php echo in the div? Is it normal for the view source not to show the updated html? That is a php question. If it isn't then it probably is the browser and options in the browser might be able to correct this? Where did you move the topic and will I be notified of replys? Thanks again, total noob. :rolleyes:

 

Oh YEAH, I added echo "<link rel type='javascript/text" etc to the .php file to no avail.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...