943,540 Members | Top Members by Rank

Ad:
Sep 11th, 2008
0

populating text field in firefox not working

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mjag16 is offline Offline
4 posts
since Sep 2008
Sep 11th, 2008
0

Re: populating text field in firefox not working

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;
Featured Poster
Reputation Points: 114
Solved Threads: 138
Posting Shark
essential is offline Offline
973 posts
since Aug 2008
Sep 12th, 2008
0

Re: populating text field in firefox not working

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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mjag16 is offline Offline
4 posts
since Sep 2008
Sep 12th, 2008
0

Re: populating text field in firefox not working

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;
Featured Poster
Reputation Points: 114
Solved Threads: 138
Posting Shark
essential is offline Offline
973 posts
since Aug 2008
Sep 15th, 2008
0

Re: populating text field in firefox not working

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mjag16 is offline Offline
4 posts
since Sep 2008
Sep 15th, 2008
0

Re: populating text field in firefox not working

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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mjag16 is offline Offline
4 posts
since Sep 2008
Sep 15th, 2008
0

Re: populating text field in firefox not working

This should do it!
If you still need anythin', just let me know. Good day...

html Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title><!--Sample--></title>
css Syntax (Toggle Plain Text)
  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>

javascript Syntax (Toggle Plain Text)
  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>
html Syntax (Toggle Plain Text)
  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>
Featured Poster
Reputation Points: 114
Solved Threads: 138
Posting Shark
essential is offline Offline
973 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Ajax script not working on firefox
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: how to access a folder using java script





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC