Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

highlighting an iframe  RSS feed

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to highlight the border of an iframe...

I'm using an onfocus method that calls this function:

function changeColor()
{
document.all.main.style.bordercolor="red";
}

however,when the iframe get the focus its bordercolor doesn't change...
the name of the iframe is "main"

Any idea?
 
Author and ninkuma
Marshal
Posts: 66678
167
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
document.all? How quaint and proprietary! you should investigate not using browser-specific features.

What reference are you using? The style property for border color is borderColor.

Case counts.

Also, please be sure to use UBB code tags when posting code. Please read this for more info.
[ February 06, 2007: Message edited by: Bear Bibeault ]
 
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do yourself a favor and forget that document.all even exists.

Give your iframe an id and use this

document.getElementById("iframeId").style.border = "5px solid #FF0";
 
Giomar Guevara
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks...it works now...
 
Whose rules are you playing by? This tiny ad doesn't respect those rules:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!