Need a better way to right this piece of javascript code

Discussion in 'JavaScript' started by Dangy, Mar 22, 2010.

  1. #1
     document.onmousedown=selectmouse;
    document.onmouseup=new Function("isdrag=false");
    Code (markup):
    The problem is that in IE, you have to double click the side scrollbar to move it, and the cause is the above code.
    The problem only exists when a Proper Valid DocType is set!


    The entire code below.

    <script type='text/javascript'>
    function styledPopupClose(id) {
      document.getElementById(id).style.display = "none";
    }
    function show_popup(id){
    window.parent.document.getElementById(id).style.display="block";
    window.parent.document.getElementById("div_id").innerHTML=id;
    }
    //document.onmousedown=selectmouse;
    //document.onmouseup=new Function("isdrag=false");
    </script>
    
    Code (markup):
    
    <style type='text/css'>
    .dragme { cursor: move }
    </style>
    
    Code (markup):
    
    <div id="div_id" style="display:none;"></div>
    
    Code (markup):
    <div id='location' name='location' class="change_location" style="display:none;position:absolute;top: 50px;left: 350px">
        <div class="head_change">
        	<img src="/accounts/movablepopups/images/newpopup_location_top.jpg" alt="Click and hold to move me around the page" title="Click and hold to move me around the page" width="370" height="21" class="dragme" />
        </div>
      <div style="width:370px;height:203px;background-image:url(/accounts/movablepopups/images/newpopup_location_bg.jpg);clear:left; position:relative;">
        <form name="searchform1" method="post" action="" onSubmit="return check_data_frame();" style="float:left; width:370px;text-align:center;margin:0px;">
                <div class="grey_12pt" style="width:370px;text-align:center;margin-top:10px;">
    
                Please enter a new location below and hit the go button
                </div>
                	<div class="grey_12pt_bold"  style="width:370px;text-align:center;margin-top:27px;">
                	WHERE  (e.g. Los Angeles,  90210)</div>
                	<div align="center"> 
                    <input name="search_bar_zip" type="text" 
                                class="grey_12pt_bold" id="search_bar_zip" style="width:240px;height:20px" onFocus="this.value=''" onBlur="if (this.value == '') {this.value = '';}" 
                                value="">
                    <input name="search_bar_category" type="hidden" class="grey_12pt_bold" id="search_bar_category" style="width:240px;height:20px" value="">
                  </div> 
                <div class="grey_10pt" style="margin-top:10px;width:370px;text-align:center;">
                Enter your City or Zip Code here
                </div>
    
    				<div align="center" style="margin-top:8px;">
                  <input name="submit" type="image" 
                        src="/../images/latest_search_go.png" width="71" height="45" 
                        border="0">
               		 </div>
          </form>
          <a href='javascript:styledPopupClose("location");' class="links_new">close</a>
          </div>
          <div style="float:left;">
    <img src="/accounts/movablepopups/images/newpopup_location_bot.jpg" width="370" height="17" /></div>
    </div>
    
    Code (markup):
    <a href="#" onClick='return show_popup("location");' style="float:right;color:#fff;font-size:10px;" rel="nofollow" id="change_l">change location</a>
    
    Code (markup):
     
    Dangy, Mar 22, 2010 IP