populating text field in firefox not working

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Sep 2008
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

 
0
  #1
Sep 11th, 2008
i have a simple url -
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <a href="javascript:displayWindow('Slice 2100 (Commercial)');">SLICE 2100 (Commercial)</a>

that passes the the variable in a javascript function -
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <script language="javascript">
  2. function displayWindow(url)
  3. {
  4. var w, h, l, t;
  5. var nc;
  6.  
  7. w = 600;
  8. h = 409;
  9. l = screen.width/4;
  10. t = screen.height/4;
  11.  
  12. nc = url;
  13. document.forms['SellSheet'].elements['sellitsheet'].value = nc;
  14.  
  15. // no title
  16. // displayFloatingDiv('windowcontent', '', w, h, l, t);
  17.  
  18. // with title
  19. displayFloatingDiv('windowcontent', 'Floating and Dimming Div', w, h, l, t);
  20.  
  21. }
  22. </script>

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

my text field
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <input type="text" style="width: 292px" class="myTextBox" id="sellitsheet" />

any ideas?

thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 954
Reputation: essential will become famous soon enough essential will become famous soon enough 
Solved Threads: 131
Featured Poster
essential's Avatar
essential essential is offline Offline
Posting Shark

Re: populating text field in firefox not working

 
0
  #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 Quick reply to this message  
Join Date: Sep 2008
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

 
0
  #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 Quick reply to this message  
Join Date: Aug 2008
Posts: 954
Reputation: essential will become famous soon enough essential will become famous soon enough 
Solved Threads: 131
Featured Poster
essential's Avatar
essential essential is offline Offline
Posting Shark

Re: populating text field in firefox not working

 
0
  #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 Quick reply to this message  
Join Date: Sep 2008
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

 
0
  #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 Quick reply to this message  
Join Date: Sep 2008
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

 
0
  #6
Sep 15th, 2008
never mind - got it to work - i had to put the
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. document.getElementsByTagName('form')['SellSheet'].elements['sellitsheet'].value = url;
lind AFTER the call to my display function!
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 954
Reputation: essential will become famous soon enough essential will become famous soon enough 
Solved Threads: 131
Featured Poster
essential's Avatar
essential essential is offline Offline
Posting Shark

Re: populating text field in firefox not working

 
0
  #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 Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC