Results 1 to 3 of 3

Thread: Trying to update an OnMouseOver...(JS)

  1. #1

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Trying to update an OnMouseOver...(JS)

    here is my JS function

    Code:
    <script type="text/javascript">
    	function prevHover() 
    	{
    
    	  var a = "this.T_WIDTH=400; this.T_BGCOLOR='#000000'; this.T_BORDERCOLOR='#666666'; this.T_FONTCOLOR='#FFFFFF'; return escape('" + document.getElementById('longd').value + "');";  
        document.getElementById('preview').onMouseOver = function(a); 
    	}
    </script>
    here is the HTML line its supposed to hit

    Code:
    <a id="preview" style="cursor: pointer; cursor: hand; color: #FFBF00;" onmouseover="this.T_WIDTH=400;this.T_BGCOLOR='#000000';this.T_BORDERCOLOR='#666666';this.T_FONTCOLOR='#FFFFFF';return escape('');" target="_blank">HOVER FOR PREVIEW</a>
    basically i just want to update the onmouseover...
    specifically the part in between the single quotes here return escape(''); but I know I cant just hit that...

    now If I just do an alert() of what the current mouseover is.. it works.. but I cant seem to set it!???

    thanks

    BTW: that code is calling another JS Script that creates a popup
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Trying to update an OnMouseOver...(JS)

    For the least you could let a separate CSS define all the colors and other styles instead of defining them in JavaScript. Just give all the elements an ID and you're pretty much good to go. Keeping styles organized in a separate file makes your JavaScript much cleaner (and simpler too).

    As for the code, are your trying to do something like this?
    Code:
    window.onload = function() {
        var preview = document.getElementById('preview');
        if( preview ) {
            preview.onMouseOver = function() {
                return alert(document.getElementById('longd').value);
            }
        }
    }

  3. #3

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Trying to update an OnMouseOver...(JS)

    no, what the onmouseover is doing is passing in code to a seperate JS (that creates a cool tooltip)
    so, all those codes are needed to set colors, size etc...

    it seems to work before I update it. then its like the JS needs to be reset or something to work again. oh well.. i think im giving up for now.
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width