Jump to content

[SOLVED] What happens when you've used both ' and " in an echo


jimmyt1988

Recommended Posts

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?

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.