RSS Forums RSS

populating text field in firefox not working

Please support our JavaScript / DHTML / AJAX advertiser: Programming Forums
Reply
Posts: 4
Reputation: mjag16 is an unknown quantity at this point 
Solved Threads: 0
mjag16 mjag16 is offline Offline
Newbie Poster

populating text field in firefox not working

  #1  
Sep 11th, 2008
i have a simple url -
 <a href="javascript:displayWindow('Slice 2100 (Commercial)');">SLICE 2100 (Commercial)</a>  

that passes the the variable in a javascript function -
				<script language="javascript">
		    function displayWindow(url)
		    {
		        var w, h, l, t;
				var nc;
				
		        w = 600;
		        h = 409;
		        l = screen.width/4;
		        t = screen.height/4;
				
				nc = url;
				document.forms['SellSheet'].elements['sellitsheet'].value = nc;				
               
                // no title		        
		        // displayFloatingDiv('windowcontent', '', w, h, l, t);

                // with title		        
		        displayFloatingDiv('windowcontent', 'Floating and Dimming Div', w, h, l, t);				
			
		    }
		</script>
 

the function then prints our the variable in a text field but it doesn't show in firefox -

my text field
 <input type="text" style="width: 292px" class="myTextBox" id="sellitsheet" />  

any ideas?

thanks
AddThis Social Bookmark Button
Reply With Quote  
Posts: 728
Reputation: essential is on a distinguished road 
Solved Threads: 104
Featured Poster
Featured Coder
essential's Avatar
essential essential is offline Offline
Master Poster

Re: populating text field in firefox not working

  #2  
Sep 11th, 2008
Hope this would help you!

Instead of this one -->
document.forms ['SellSheet'].elements['sellitsheet'].value = nc;
Try doing it like this -->
document.SellSheet.sellitsheet.value = nc;
Reply With Quote  
Posts: 4
Reputation: mjag16 is an unknown quantity at this point 
Solved Threads: 0
mjag16 mjag16 is offline Offline
Newbie Poster

Re: populating text field in firefox not working

  #3  
Sep 12th, 2008
thanks for the quick reply - but that doesn't work either. in fact, i originally had that string and changed it b/c i saw some post on the net saying firefox couldn't understand that type of syntax.

any other ideas?

thanks!
Reply With Quote  
Posts: 728
Reputation: essential is on a distinguished road 
Solved Threads: 104
Featured Poster
Featured Coder
essential's Avatar
essential essential is offline Offline
Master Poster

Re: populating text field in firefox not working

  #4  
Sep 12th, 2008
This should work!
If not then try this reference guide @
http://developer.mozilla.org/en/The_DOM_and_JavaScript --

document.getElementsByTagName('form')['SellSheet'].elements['sellitsheet'].value = nc;
Reply With Quote  
Posts: 4
Reputation: mjag16 is an unknown quantity at this point 
Solved Threads: 0
mjag16 mjag16 is offline Offline
Newbie Poster

Re: populating text field in firefox not working

  #5  
Sep 15th, 2008
still nothing - it's weird b/c i'll put a document.write in the function and it reads the passed variable but nothing i do gets the text field to populate in firefox or safari.
Reply With Quote  
Posts: 4
Reputation: mjag16 is an unknown quantity at this point 
Solved Threads: 0
mjag16 mjag16 is offline Offline
Newbie Poster

Re: populating text field in firefox not working

  #6  
Sep 15th, 2008
never mind - got it to work - i had to put the
 document.getElementsByTagName('form')['SellSheet'].elements['sellitsheet'].value = url;	 
lind AFTER the call to my display function!
Reply With Quote  
Posts: 728
Reputation: essential is on a distinguished road 
Solved Threads: 104
Featured Poster
Featured Coder
essential's Avatar
essential essential is offline Offline
Master Poster

Re: populating text field in firefox not working

  #7  
Sep 15th, 2008
This should do it!
If you still need anythin', just let me know. Good day...

  1. <html>
  2. <head>
  3. <title><!--Sample--></title>
  1. <style type="text/css">
  2. <!--
  3. a { text-decoration: none; }
  4. form input { border: none; }
  5. #screen
  6. { position: fixed;
  7. left: 10px;
  8. top: 10px;
  9. text-align: center;
  10. font-weight: bold;
  11.  
  12. /* You may change the width and height if it is necessary.
  13. */
  14. width: 200px;
  15. height: 40px;
  16. background-color: #C0C0C0;
  17. color: #A6A6A6;
  18. }
  19. -->
  20. </style>

  1. <script type="text/javascript">
  2. <!--
  3. function load()
  4. { thisLink = document.getElementById('link1');
  5. thisLink.addEventListener('click', function displayWindow() {
  6. container = document.sellSheet.sellitsheet; screen = document.getElementsByTagName('div')[0];
  7. screen.id = 'screen'; screen.firstChild.nodeValue = thisLink.title;
  8. container.value = thisLink.title;
  9. }, false );
  10. }
  11. //-->
  12. </script>
  1. </head>
  2. <body onload="load();">
  3. <p align="center">
  4. <div>&nbsp;</div><br /><br />
  5. <a id="link1" href="#" alt="" title="SLICE 2100 (Commercial)">SLICE 2100 (Commercial)</a><br />
  6. <form name="sellSheet" action="#" onsubmit="return false;">
  7. <input type="text" name="sellitsheet" size="20" value="" />
  8. </form>
  9. </p>
  10.  
  11. </body>
  12. </html>
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the JavaScript / DHTML / AJAX Forum
Views: 1485 | Replies: 6 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 10:34 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC