SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getElementById() returns null?

    i have this form called form1 and inside the form i have a text input called des

    if i use document.getElementById('des'); it returns as null and i can't do anything with it, but if i do document.getElementById('form1'); it returns an object and i can do something with it.

    does anyone know what im doing wrong? why is it returning null?


    Thanks
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    What does the HTML look like?
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall
    What does the HTML look like?
    HTML Code:
    <form action="" method="post" enctype="multipart/form-data" name="form1" class="style2">
    	<table border="0" cellpadding="0" cellspacing="5">
    	<tr><td>
    	Project Type:
    	</td><td>
    	<select id="port_type" name="port_type" onchange="show_hide_pop()">
    	<option <?php if($isWeb == 'true'){ echo 'selected="selected"'; } ?> id="web">Website</option>
    	<option <?php if($isFlash == 'true'){ echo 'selected="selected"'; } ?> id="flash">Flash</option>
    	<option id="image">Image</option>
    	</select>
    	<script>
    	show_hide_pop();
    	</script>
    	</td></tr>
    	<tr><td>
    	Project Name:
    	</td><td>
    	<input type="text" id="name" name="name" size="35" value="<?=$name?>" />
    	</td></tr>
    	<tr><td>
    	Pop-Up URL:
    	</td><td>
    	<input type="text" name="des" id="des" size="35" value="<?=$popup?>" />
    	</td></tr>
    	<tr><td>
    	Pop-Up File:
    	</td><td>
    	<input name="popup" type="file" id="popup" size="20" value="<?=$popup?>">
    	</td></tr>
    	<tr><td>
    	Image:
    	</td><td>
    	<input name="product_image_sm" type="file" id="product_image_sm" size="20" value="<?=$image?>">
    	</td></tr></table>
    	<?php
    	if($_GET['project_id']){
    		echo '<input type="submit" name="Update"  id="Update" value="Update"/>';
    	}else{
    		echo '<input type="submit" name="Create"  id="Create" value="Create"/>';
    	}
    	?>
    	<br />
    </form>
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.


Bookmarks

Posting Permissions

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