Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 24th, 2006, 12:19 PM
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default IE not performing onFocus event for <select>

Hi there,
I am having a problem with IE not allowing a CSS border to be drawn through javascript
in an onFocus event.

Here's an example:
<div class = "fieldname">Requester Name: <span style = "color:#FF0000"> *</span><br>
  <select class = "field"
          name = "Requester Info"
          id = "RequesterName"
          onFocus = document.getElementById('RequesterName').style.bor der = '2px solid #3EC4FE'"
          onBlur = "document.getElementById('RequesterName').style.bo rder = '2px solid #CCCCCC'">
          <option value = "Select your name">Select your name</option>
  </select>
</div>

so basically when the select gains focus, a border is drawn around it to show the user where they are in the form.

This code works just fine on Gecko/Mozilla/KHTML but does not work in IE, cannot figure it out.

Any help would be appreciated.

Thanks.
Reply With Quote
  #2 (permalink)  
Old January 24th, 2006, 12:30 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You're missing a double quote:

onFocus = "document.getElementById('RequesterName').style.bo rder = '2px solid #3EC4FE'"

You can also do it this way and save space:

onFocus = "this.style.border = '2px solid #3EC4FE'"

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply With Quote
  #3 (permalink)  
Old January 24th, 2006, 12:41 PM
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey there,

Thank you for the response. I tried what you pasted in, no-dice.

Are you able to replicate this error on your machine? If so, let me know cos i'm starting to think that there is something in a JavaScript include that is causing this.

Thanks for the help,
IK
Reply With Quote
  #4 (permalink)  
Old January 24th, 2006, 01:35 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Oops, well, according to these MSDN documents the <select> object does not support the border property. Seemed like I used a border property on those before, but I guess I'm mistaken.

http://msdn.microsoft.com/workshop/a...cts/select.asp
http://msdn.microsoft.com/workshop/a...s/border_0.asp

The only way to work around that is to build your own <select> like object using JavaScript.

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply With Quote
  #5 (permalink)  
Old January 24th, 2006, 02:10 PM
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for the links. i know for a fact that i have done that before using document.getElementById("").style.borderStyle, borderColor and borderWidth..

weirdness. i appreciate your help.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<select> </select> prabhash_singh11 PHP How-To 2 March 11th, 2008 09:08 AM
select="<b>" AlDugan XSLT 8 March 24th, 2006 02:01 PM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
HELP: XSL -> HTML <select selected=true> jedbartlett XSLT 4 October 7th, 2004 11:16 PM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM



All times are GMT -4. The time now is 09:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.