Link to home
Start Free TrialLog in
Avatar of java_kevin
java_kevin

asked on

NS 6.1

Does NS6.1 need any specific JS implementation requirement tat NS4.x dun?
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

What do you mean?

NS6.1 has a new version of JS built-in (js 1.3 I believe)
The DOM no longer supports the layer tag, but that is not the fault of the JS engine

Michel
Avatar of java_kevin
java_kevin

ASKER

Hahah... why is it always you are the answerer?

I mean, my js works in 4.x but when I tried 6.1, it suckx... Anyway, I use simple Js, I don' even know what's DOM. So I wonder if there's any special js coding needed in 6.1 which isn't required in 4.x

And... if i keep calling: win = open(....), is this wasteful of resources?
it's under a function which i call whenever needed.

And once a floating window is opened, can its var value be changed from its opener window?

and if i were to specify <script src="bla.." but need another var in same html, do i declared another <script></s>?

Thanks.
And I noted that under 4.7x, my styling were ok. But NS6.1 would display a scrollbar for it, as though the page need a space bigger than allocated. Why is it so?

If i keep calling: win = open(....), is this wasteful of resources? it's under a function which i call whenever needed.

If "win" is closed by the user, how cna I make it open again? 'Cos win will be !=null. I tried using:
If (!win)
win=open ...
to save resources if my logic is correct.

This' the code:
function lyrics(name, dir) {
     if (!win)
win=open("../../lyrics.html","lyric","height=430,width=300");

     url="lyrics/"+dir+"/"+name;
     win.comments.location=name+"_C.html";
     win.words.location=name+".txt";
     win.options.location="../../options.html";
     win.focus();
}
And I noted that the first time "win" is opened, its child frames are not recognised by names yet. Can I solve it by using frames[index]? Or do I use a time delay?

Thanks.
PS: I need the answers, regardless of the answerer :)
if (!win || (win && win.closed))
win=open("../../lyrics.html","lyric","height=430,width=300");

and yes you need to use timeout

umm... have a few more questions... pts can be increased.

how do i use timeout function?
For some languages, using random produces similar results at times. Will js have same problem?

win=null; // create a global var;
function lyrics(name, dir) {
    if (!win || (win && win.closed))

win=window.open("../../lyrics.html","lyric","height=430,width=300");

   setTimout('setLocation("'+name+'","'+dir+'")',1000);
}

function setLocation(name,dir) {
    url="lyrics/"+dir+"/"+name; // Where do you use that?

    win.comments.location=name+"_C.html";
    win.words.location=name+".txt";
    win.options.location="../../options.html";
    win.focus();

}

However I think you might want to do this instead:


win=null; // create a global var;
function lyrics(name, dir) {
    if (!win || (win && win.closed))

win=window.open("dummy.html","lyric","height=430,width=300");

   setTimout('setLocation("'+name+'","'+dir+'")',200);
}

function setLocation(name,dir) {
   var url="lyrics/"+dir+"/"+name; // Where do you use that?

   var txt ='<fra'+'meset cols="*,*,*" onLoad="window.focus()">'+
   '<frame name="comments" src="'+name+'_C.html">'+
   '<frame name="words" src="'+name+'.txt">'+
   '<frame name="options" src="../../options.html">'+
   '</fra'+'meset>';
   win.document.write(txt);
   wind.document.close();

}
Suggestion taken.

The "url" orignally is for the "win" to take parameters from parent.

Does settimeout take string or something as first arg? but the sequence of quotes looks strange.
Why do u need to clearly state "<fra"+"meset.."? cant "<frameset.."?
Lastly, dun think win.doc.close is needed so fast. delting it off.
And the function is settimeout correct?
1, SetTimeout takes a javascript argument as first parm, milliseconds delay as second.

What you want to defer is

setLocation(name,dir)

but since name and dir is no longer around (local vars) when setTimout triggers, we RECREATE the strings so when it triggers if you called lyrics("fred","bob") then name = "fred" and dir = "bob" then you get
setLocation("fred","bob") when setTimout runs

2. Some browsers (ie in some versions) will attempt to render a frameset if it is in a string in the page. I will not see it is in javascript. Same for DIV, BODY and especially </script> !!!

3. to create a complete html file in a new window or frame you need to do
document.write('something');
document.close();

where document.close is the equivalent of </html> in a normal page and will FINISH the dynamic creation. It has NOTHING to do with window.close() which will close the window.

Michel
I seem to have little prob wif frame creation for NS6. For NS4x, the frames were fine. But in 6, each frame can't have just exactly e amt of space needed for display. Addtional space need to be set to avoid scrollbars. U can use NS6 for http://www.geocities.com/luv_ktv/ n when u go to singers, the bars appear. Why is it so?

Also, when I do a simple open("bla bla",...), the calling window actually returned [Object window] after opening 1. What's the cause?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks... u know about layer?

In NS6, <layer name=f1 src="..." visi="show"></layer> doesn't work... but NS4+ can.. y?

And since better to use onclick, y some websites still use js:function()?

Lastly, my website is up :) thanks to u.. and feel free to visit it :)
http://www.geocities.com/luv_ktv/
Sorry.. forgot 1 last impt query.

<a href="javascript:alert('Page not done yet');"
onMouseOver="window.status='Page not done yet'; return true;">

in 6, the mouse lines dun work as well. but fine in 4+. Does mouseover work on images?
And I read that it's preferred to put "void(0)" in place for #. Your opinions?
1. No layers in NS6. User <div id="f1" style="position:absolute">
and it will owrk in IE, NS4 and NS6  - the last using using document.getElementById('f1').... where you use document.all('f1') in IE
2. No void needed. Change

<a href="javascript:alert('Page not done yet');"
onMouseOver="window.status='Page not done yet'; return true;">
to

<a href="#" onClick="alert('Page not done yet');
return false"
onMouseOver="window.status='Page not done yet'; return true;">

the return false works like the void would
No mouseiver on Images in NS4 or ns6
umm... wat i mean is, window.status, not mouse :)
i mean, the window.status shld work correct? But in 6, in doens't work as well. I think it's fine in 4 though.
umm... tat din quite ans my question though... but nvm :)

i'm using <a ... onmouseover="window.status='...';">