Jump to content

nogray

Members
  • Posts

    930
  • Joined

  • Last visited

Posts posted by nogray

  1. try to put all your attrbuite values in quotes

    <form method="POST" action="blahblah" ....
    <a href="javascript:document.view$ff_draft_team_name.submit();" ...
    

     

    Also, beside giving the form a name, give it an id too

    <form id="formID" ....

     

    after that, you can use document.getElementById() function

  2. change the exit statment to something like this

    exit("<script language=\"javascript\">location.href=\"company1.html\";</script>If you are not redirected in 2 seconds, please <a href=\"company1.htmt\">click here</a>");
    

  3. Just hide and show the buttons as well

    <a href="#" onclick="hideStuff('deals'); hideStuff('hide_link); showStuff('show_link'); return false;" id="hide_link"><img src="images/hide.png" width="10" height="10" border="0"></a>
    
    <a href="#" onclick="showStuff('deals'); hideStuff('show_link); showStuff('hide_link');  return false;" id="show_link"><img src="images/show.png" width="10" height="10" border="0"></a>
    

  4. You only need to write your functions in the javascript once (don't write the function in the while loop)

     

    And you mixing javascript and PHP when writing the image tag (id=imgId). This will make all your images have one id "imgId".

     

    Also, the while loop shouldn't have a ; after it

     

    It should be

    while (statment) {
       do something
    }
    

     

    You can change your image tag to look like the following

    <img src=$d2 border=0 width=$width height=$height onmouseover=imgEnlarge(this) onmouseout=imgShrink(this)>
    

     

    and your functions to this

    function imgEnlarge(obj){
       obj.height += 100;
       obj.width += 100;
    }
    function imgShrink(obj){
       obj.height -= 100;
       obj.width -= 100;
    }
    

  5. Try to use the NoGray javascript library, there is a getStyle function that will return the current style of the object.

     

    Since the documentations are a bit outdated, here is a quick example

    <html> 
    <head> 
    <title>getStyle Example</title> 
    
    <!-- including the base.js -->
    <script language="javascript" src="nogray_lib/base.js" type="text/javascript"></script> 
    
    <script language="javascript">
    function ini_page(){
    	// this function will assign the NoGray libraray methods
    	// to the object
    	// _obj() is the same as document.getElementById()
    	make_NoGray(_obj('wdiv'));
    
    	// getting the style attributes
    	// you need to use a full attribute for example
    	// backgroundColor rather than background
    
    	var txt = "Background color: "+_obj('wdiv').getStyle("backgroundColor")+"\n";
    	txt += "Font family: "+_obj('wdiv').getStyle("fontFamily")+"\n";
    	txt += "Height: "+_obj('wdiv').getHeight()+"\n";
    	txt += "Width: "+_obj('wdiv').getWidth();
    
    	alert(txt);
    }
    </script>
    </head> 
    <body onLoad="ini_page();"> 
    <div id="wdiv">Hello World</div> 
    </body> 
    </html> 
    

  6. Well, you can use a "try and catch" statment. It's not a perfect solution but it works.

    <script language="javascript">
    function checkID(){
    	try {
    		var objID = document.getElementById(document.getElementById('input1').value).id;
    		alert("ID is already in use");
    		return true;
    	}
    	catch(e){
    		alert("There is no object with this ID");
    		return false;
    	}
    }
    </script>
    <div id="div1">First Div</div>
    <input type="text" id="input1" value="div1" />
    <button onclick="checkID();">Check if ID</button>
    

  7. What happens is the thumb nail library you're using will look at the HTML (not javascript) code when the page loads to assign the onclick events to them. Since your drop down uses JavaScript to generate the links, you'll need to assign the onclick event from the library after the links are generated.

     

    Or the easiest way is to create a hidden div with the link inside (as html) and use the javascript to show and hide that div rather than creating the whole thing.

  8. The first script will run the Javascript before the browser writes the div tag, so it will look for the div tag but can't find (error, the object haven't loaded)

     

    The second one will run the script after.

     

    To be safe, always make sure your page loads before trying to access element. You can add an onload even in the body tag and run a function from there

    <head>
    <script type="text/javascript">
    	function write_UN(){
    		document.getElementById('login_button').innerHTML = "George";
    	}
    </script>
    </head>
    <body onload="write_UN();">
    

     

    Also, This.value should be this.value (lower case letters)

  9. Try this function

    function deleterow(rvalue) {
            var answer = confirm("Are you sure you want to delete?");
            var values = rvalue.split("|");
        if(answer){
    		document.getElementById('ch'+values[0]).innerHTML = "CH1";
    		document.getElementById('bh'+values[0]).innerHTML = "BH1";
        } else { 
    	    alert(values[0] + '-' + values[1] + '-' + values[2] + '-' + values[3]);
        }
        }
    

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