/    Sign up×
Community /Pin to ProfileBookmark

clipower script not working in ie & netscape PLEASE HELP

Can anyone convert this script which is to dynamically create a tab control ([url]http://www.relpaxchallenge.com/patient/jsnet.htm[/url]) so that it is netscape7 and ie6 compliant?

Problems – dom comp table creation & attachevent (as well as addEventListener not working) in netscape

to post a comment
JavaScript

23 Comments(s)

Copy linkTweet thisAlerts:
@JonaSep 26.2003 — [font=arial][color=maroon]The JavaScript code is there, but could you make a page with the HTML and JavaScript code combined so that I may "test" the script?[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 26.2003 — Jona,

Here it is: http://www.relpaxchallenge.com/patient/fortest.htm

Thanks for any help you can offer!

Karen
Copy linkTweet thisAlerts:
@JonaSep 26.2003 — [font=arial][color=maroon]I was asking for the HTML to be formatted--I don't need the HTML code itself, I'd like to see what it actually does.[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@JonaSep 26.2003 — [font=arial][color=maroon]Perhaps this will work (untested)...[/color][/font]

[font=monospace]

function Tab_obj()

{

this.Name = '';

this.Height = 0;

this.Width = 0;

this.defaultDisplayTabNo = 1;

this.ContainerDiv;

this.theme;

this.TabArray = new Array();

this.ButtonArray = new Array();

this.SetTabDiv = SetTabDiv;

this.GenerateControl = GenerateControl;

}

function SetTabDiv(tabNo, DivObj, Desc)

{

this.TabArray[tabNo] = new Array();

var theme_class = "display_" + this.theme;

DivObj.className = theme_class;

this.TabArray[tabNo][0] = DivObj;

this.TabArray[tabNo][1] = Desc;

}

function ShowTab(evt)

{

var reqTab = (document.all)?event.srcElement.name:evt.target.name;

var ctrlName = (document.all)?event.srcElement.id:evt.target.id;

var obj = eval(ctrlName);

var theme_class = "display_" + obj.theme;

var theme_buttonSel = "tabButtonSel_
" + obj.theme;

var theme_button = "tabButton_" + obj.theme;

for(var i=1; i < obj.TabArray.length; i++)

{

if ( i == reqTab )

{

obj.TabArray[i][0].className = theme_class;

obj.ButtonArray[i].className = theme_buttonSel;

}

else

{

obj.TabArray[i][0].className = "hide";

obj.ButtonArray[i].className = theme_button;

}



}





}



function GenerateControl()

{



var theme_class = "container_" + this.theme;

this.ContainerDiv.className = theme_class;

this.ContainerDiv.style.height = 800;

this.ContainerDiv.style.width = this.Width;



var theme_class = "tabButton_" + this.theme;



var buttonDiv = document.createElement("DIV");



var tabTable = document.createElement("TABLE");

var tabRow = tabTable.insertRow();



for(var i=1; i < this.TabArray.length; i++)

{



var tabCell = tabRow.insertCell();

var tabButton = document.createElement("INPUT");
tabButton.type = 'BUTTON';
tabButton.value = this.TabArray[i][1];
tabButton.name = i;
tabButton.id = this.Name;
tabButton.className = theme_class;

if(document.all){

tabButton.attachEvent('onclick', ShowTab);

} else {

tabButton.onClick="ShowTab(evt);";

}

this.ButtonArray[i] = tabButton;



tabCell.insertBefore(tabButton);

}


buttonDiv.insertBefore(tabTable);

this.ContainerDiv.insertBefore(buttonDiv);

theme_class = "display_" + this.theme;

for(var i=1; i < this.TabArray.length; i++)

{

var divObj = this.TabArray[i][0];

divObj.style.width = this.Width - 0;

divObj.style.height = this.Height - -1000;

divObj.style.position = 'relative';

divObj.style.left = 2+"px";

divObj.style.top = 5+"px";







this.ContainerDiv.insertBefore(this.TabArray[i][0]);
if ( i == this.defaultDisplayTabNo )
this.TabArray[i][0].className = theme_class;
else
this.TabArray[i][0].className = "hide";


}

return true;

}

[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 26.2003 — Jona,

At first I got the insertRow is not a function error so I change it to createElement, but now I get these errors in the htm page:

var myTab = new Tab_obj(); //line 38 says "not defined"

myTab.Name = "myTab"; //line 44 says has no properties


Everything still works beautifully in IE though.

Karen
Copy linkTweet thisAlerts:
@JonaSep 26.2003 — [font=arial][color=maroon]It looks like you're using myTab.Name twice (setting it to '' and then setting it to 'myTab'). Why not just do it once?[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 26.2003 — You mean once in the js file and once in the htm file? I deleted the one from the htm file and put the name "myTab" in the "" for the js file. Now I am getting an error on the js file:

tabCell.insertBefore(tabButton);


line 88 null is null or not an object
Copy linkTweet thisAlerts:
@JonaSep 26.2003 — [font=arial][color=maroon]Hmm... At this point, I suppose I will bang my head against the wall, download all of the scripts and HTML you have provided me with, and do what I can to get it fixed. I'll reply back when I have the time to assist you more, or when I have found a solution, since this script is very large and complex.[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 26.2003 — Thank you so much, Jona!! I am trying (and have been trying) for the past week. I'm very proficient in asp/vbscript, but now everything we do must be netscape compliant. I have tried contacting the author of clipower with no success and have also looked for other tab control scripts out there that are compliant with both browsers. Mostly, everything now avail is .net which I do not know yet either.

I will post the solution asap if I find it, but it sounds like you know 343243242x more than I do.
Copy linkTweet thisAlerts:
@JonaSep 26.2003 — [font=arial][color=maroon]Could you post the "new" code, please?[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 27.2003 — Here is the latest js file:


function Tab_obj()

{

this.Name = "myTab";

this.Height = 0;

this.Width = 0;

this.defaultDisplayTabNo = 1;

this.ContainerDiv;

this.theme;

this.TabArray = new Array();

this.ButtonArray = new Array();

this.SetTabDiv = SetTabDiv;

this.GenerateControl = GenerateControl;

}

function SetTabDiv(tabNo, DivObj, Desc)

{

this.TabArray[tabNo] = new Array();

var theme_class = "display_" + this.theme;

DivObj.className = theme_class;

this.TabArray[tabNo][0] = DivObj;

this.TabArray[tabNo][1] = Desc;

}

function ShowTab(evt)

{

var reqTab = (document.all)?event.srcElement.name:evt.target.name;

var ctrlName = (document.all)?event.srcElement.id:evt.target.id;

var obj = eval(ctrlName);

var theme_class = "display_" + obj.theme;

var theme_buttonSel = "tabButtonSel_
" + obj.theme;

var theme_button = "tabButton_" + obj.theme;

for(var i=1; i < obj.TabArray.length; i++)

{

if ( i == reqTab )

{

obj.TabArray[i][0].className = theme_class;

obj.ButtonArray[i].className = theme_buttonSel;

}

else

{

obj.TabArray[i][0].className = "hide";

obj.ButtonArray[i].className = theme_button;

}



}





}



function GenerateControl()

{



var theme_class = "container_" + this.theme;

this.ContainerDiv.className = theme_class;

this.ContainerDiv.style.height = 800;

this.ContainerDiv.style.width = this.Width;



var theme_class = "tabButton_" + this.theme;



var buttonDiv = document.createElement("DIV");



var tabTable = document.createElement("TABLE");

var tabRow = document.createElement("TR");



for(var i=1; i < this.TabArray.length; i++)

{



var tabCell = document.createElement("TD");



var tabButton = document.createElement("INPUT");

tabButton.type = 'BUTTON';

tabButton.value = this.TabArray[i][1];

tabButton.name = i;

tabButton.id = this.Name;

tabButton.className = theme_class;

if(document.all){

tabButton.attachEvent('onclick', ShowTab);

} else {

tabButton.onClick="ShowTab(evt);";

}

this.ButtonArray[i] = tabButton;



tabCell.insertBefore(tabButton);



}





buttonDiv.insertBefore(tabTable);

this.ContainerDiv.insertBefore(buttonDiv);



theme_class = "display_" + this.theme;



for(var i=1; i < this.TabArray.length; i++)

{

var divObj = this.TabArray[i][0];

divObj.style.width = this.Width - 0;

divObj.style.height = this.Height - -1000;

divObj.style.position = 'relative';

divObj.style.left = 2+"px";

divObj.style.top = 5+"px";







this.ContainerDiv.insertBefore(this.TabArray[i][0]);

if ( i == this.defaultDisplayTabNo )

this.TabArray[i][0].className = theme_class;

else

this.TabArray[i][0].className = "hide";



}



return true;

}
Copy linkTweet thisAlerts:
@JonaSep 27.2003 — [font=arial][color=maroon]Would you prefer to use a much more simplified code to simply hide the second and third tabs, and only show the first; then when the second is clicked, hide the first and make sure the third is still hidden, and the same for the third?



I was just thinking, but is there a specific reason for using this code? It seems a great deal of work, since I commonly have some problems dealing with Netscape as well.



Also, the updated code does not work in IE, either.[/color]
[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 27.2003 — I will happily take whatever works. Yes, I know it stopped working in IE after the last changes. But at least netscape and ie were sporting the same error for once.

Thanks,

Karen
Copy linkTweet thisAlerts:
@JonaSep 27.2003 — [font=arial][color=maroon]I will work on an alternative solution, and see if you would like to use it.[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 27.2003 — Thanks, Jona!!!
Copy linkTweet thisAlerts:
@JonaSep 27.2003 — [font=arial][color=maroon]I hope you will like this much simpler solution I've come up with... It is attached as a .txt file. Please save it as a .html file, and run it to see its effect.[/color][/font]

[b][J]ona[/b]

[upl-file uuid=9a7043bc-17c1-41a8-89ea-6a47c29b1517 size=11kB]fortest.txt[/upl-file]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 30.2003 — JONA!!

This is awesome! I have studied your code and am already thinking of ways to apply it elsewhere.

I have been waiting for your response and didn't realize you had already responded with this magnificent code.

I CANNOT thank you enough!

Karen
Copy linkTweet thisAlerts:
@JonaSep 30.2003 — [font=arial][color=green]You're welcome. It's much more simple than the code that you had, but you may want to make all of them visible to start with, and then make the second two invisible onLoad. That way, people without JavaScript but that have CSS enabled will be able to access all three forms.[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 30.2003 — Thanks, that is good to know for the future. For this web site we are "requiring" they have scripting enabled or else a lot of other stuff would not work.

Can I use activex controls now with Netscape 7 or should I just use applets?

Karen
Copy linkTweet thisAlerts:
@JonaSep 30.2003 — [font=arial][color=maroon]Applets will work in Netscape, but ActiveX controls only work in IE, I believe... I could be wrong.[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@kdorrickauthorSep 30.2003 — I think in Netscape 6 ax controls weren't working. I guess I'll find out soon enough. Thanks again for all your help!
Copy linkTweet thisAlerts:
@JonaSep 30.2003 — [font=arial][color=green]You're welcome. ?[/color][/font]

[b][J]ona[/b]
×

Success!

Help @kdorrick spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...