Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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!

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

  • Author

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.

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...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.