Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Converting a string to an object variable


Message #1 by "Majid Qazi" <majid@i...> on Sat, 28 Apr 2001 21:19:19
Hi Majid,

I don't think you can without writing a lot of code. First of all, you 
always need to do a browser check. There are good scripts available ("the 
ultimate JavaScript client sniffer") for example to determine the exact 
browser.

Then, depending what you are trying to accomplish, some stuff might work 
more or less the same, other things are more complicated. If you need 
layers, you'll have to do extra coding anyway as those are only supported 
by NN4 (NN6 does not even support them anymore).

But it all depends what you are trying to do. If you can do things server 
side, you might want to move some logic there for older browsers. In recent 
browsers, do you stuff client side and then submit it.

If that's not an option, I am afraid you'll have to do a lot of coding......

Imar




At 12:45 AM 4/30/2001 +0000, you wrote:
>Thanks a lot Imar. It's working perfectly.
>
>A  question -- how can we adapt this code to earlier versions of Netscape
>or IE without writing pages and pages of code?
>
>Majid Qazi
>
>
> > If it's only to work in IE and Netscape 6, consider using
>getElementById,
> > like below. The code is from a previous post I made, but it'll show the
> > principle.
> > getElementById will be the preferred method of referring to DOM
>elements.
> > See also http://www.w3.org/DOM/
> >
> > <script language="JavaScript">
> >      function doIt()
> >      {
> >          document.getElementById("myRow").bgColor='red';
> >      }
> > </script>
> >
> > <table width="100%">
> > <tr id="myRow">
> >          <td>
> >                  Test
> >          </td>
> > </tr>
> > </table>
> >
> > <form id="frmMyForm">
> >      <input type="button" onClick="doIt();" value="Click me">
> > </form>
> >
> > Hope this helps,
> >
> > Imar
> >


  Return to Index