Jump to content

IDK

Members
  • Posts

    4
  • Joined

  • Last visited

IDK's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. IDK

    IE probs

    It works with Firefox...When I try to modify the object it doesn't work, but if I put an alert in the middle it executes.I just want the following to work under IE and FFIt seams like IE doesn't like me function updatetitle(){ if(document.all) { var titletext=document.all["titletext"]; var theiframe=document.all["theiframe"]; var leftline=document.all["leftline"]; var rightline=document.all["rightline"]; } else if(document.getElementById) { var titletext=document.getElementById("titletext"); var theiframe=document.getElementById("theiframe"); var leftline=document.getElementById("leftline"); var rightline=document.getElementById("rightline"); } titletext.innerHTML=theiframe.contentDocument.title; var titlelength=theiframe.contentDocument.title.length; leftline.style.width= 350 - titlelength * 5; rightline.style.width= 310 - titlelength * 5;} Then if it can't be done with IE, I would want to put some other code there instead to make it a little nicer, but it wont allow that either becouse both of the if statements is true in IE.
  2. IDK

    IE probs

    Why does IE say it can use document.getElementById when it can't?How can I fix this? if(document.all) { var titletext=document.all["titletext"]; } else if(document.getElementById) { var titletext=document.getElementById("titletext"); } this doesn't work!!How? Why? When??Please help me, I'm a programmer but hate messy unexplainable problems...
  3. Thanks for you reply, but I need it to work with IE. Otherwise my site would be very bad.Do anyone know how to write such a script
  4. I making a site, but I don't know how to write crossbrowser code.This works fine in Firefox, but don't in IE...I tried to improve the code by doing like I've seen other's do, like adding the short if statement... //IDKfunction updatetitle(){ if (ie4||ns6){ var titletext=document.getElementById? document.getElementById("titletext") : titletext; var theiframe=document.getElementById? document.getElementById("theiframe") : theiframe; var leftline=document.getElementById? document.getElementById("leftline") : leftline; var rightline=document.getElementById? document.getElementById("rightline") : rightline; titletext.innerHTML=theiframe.contentDocument.title; var titlelength=theiframe.contentDocument.title.length; leftline.width= 350 - titlelength * 5; rightline.width= 310 - titlelength * 5; }}} How do I make it work?titletext is a spanthe lines are imgI'm an experienced programmer, but javascript is to messy, almost messier that asm...
×
×
  • Create New...