jimmyt1988 Posted October 8, 2009 Share Posted October 8, 2009 1. My problem came up when I had a javascript that required ' and html that required ". Is this the best way of overcoming this problem? Because it seems sketchy but works. <?php function topRightBarImage(){ $homeButton = "'images/homeButton.jpg'"; $homeButtonO = "'images/homeButtonO.jpg'"; $linkButton = "'images/linkButton.jpg'"; $linkButtonO = "'images/linkButtonO.jpg'"; $contactButton = "'images/contactButton.jpg'"; $contactButtonO = "'images/contactButtonO.jpg'"; echo ' <a href = "index.php"><div id = "logoImage"> </div></a> <div id = "topRightBarImage"> <div id = "buttonPosition"> <div class = "button"> <a href = "index.php"><img title = "home" src = "images/homeButton.jpg" onmouseover="this.src=' . $homeButtonO . '" onmouseout="this.src=' . $homeButton . '"></a> </div> <div class = "button"> <a href = "links.php"><img title = "links" src = "images/linkButton.jpg" onmouseover="this.src=' . $linkButtonO . '" onmouseout="this.src=' . $linkButton . '"></a> </div> <div class = "button"> <a href = "contactUs.php"><img title = "contact us" src = "images/contactButton.jpg" onmouseover="this.src=' . $contactButtonO . '" onmouseout="this.src=' . $contactButton . '"></a> </div> </div> </div> '; } ?> 2.Side question is nothing to do with php but perhaps u know. javascript and hidden divs dont work as hover over preloads in Opera, any other way round the problem? Quote Link to comment https://forums.phpfreaks.com/topic/176936-solved-what-happens-when-youve-used-both-and-in-an-echo/ Share on other sites More sharing options...
Bendude14 Posted October 8, 2009 Share Posted October 8, 2009 can't see anything wrong with how you are using the quotes. Can't really help with the javascript without seeing how you are doing it now? Quote Link to comment https://forums.phpfreaks.com/topic/176936-solved-what-happens-when-youve-used-both-and-in-an-echo/#findComment-932895 Share on other sites More sharing options...
jimmyt1988 Posted October 8, 2009 Author Share Posted October 8, 2009 1. Cheers, just thought it looked wrong. 2. This is put in the header, excuse the comments Tbh don't worry about this. it's nothing to do with php, just a side comment. I'll put issue as resolved in about 5 minutes. I just wanted to know if what I was doing was correct with the php part. Apparently Opera doesn't load hidden divs images. clever, but frustrating. <!--<SCRIPT language='JavaScript'> <!-- if (document.images) { preload_image_object = new Image(); // set image url image_url = new Array(); //image_url[0] = 'images/homeButton.jpg'; image_url[0] = 'images/homeButtonO.jpg'; //image_url[2] = 'images/linkButton.jpg'; image_url[1] = 'images/linkButtonO.jpg'; //image_url[4] = 'images/contactButton.jpg'; image_url[2] = 'images/contactButtonO.jpg'; //image_url[6] = 'images/designButton.jpg'; image_url[3] = 'images/designButtonO.jpg'; //image_url[8] = 'images/developButton.jpg'; image_url[4] = 'images/developButtonO.jpg'; //image_url[10] = 'images/profileButton.jpg'; image_url[5] = 'images/profileButtonO.jpg'; var i = 0; for(i=0; i<=5; i++) preload_image_object.src = image_url[i]; } //--> </SCRIPT>--> Quote Link to comment https://forums.phpfreaks.com/topic/176936-solved-what-happens-when-youve-used-both-and-in-an-echo/#findComment-932901 Share on other sites More sharing options...
Adam Posted October 8, 2009 Share Posted October 8, 2009 You'd be better adding escaped quotes around the strings used in "this.src=...", for example: onmouseover="this.src=\'' . $homeButtonO . '\'" Quote Link to comment https://forums.phpfreaks.com/topic/176936-solved-what-happens-when-youve-used-both-and-in-an-echo/#findComment-932908 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.