Closed Thread Icon

Topic awaiting preservation: Combining Scripts (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8027" title="Pages that link to Topic awaiting preservation: Combining Scripts (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Combining Scripts <span class="small">(Page 1 of 1)</span>\

 
Skatefx
Bipolar (III) Inmate

From: Small Patch of Grass in CT
Insane since: Mar 2001

posted posted 01-14-2002 08:05

I am using this script for a static menu

code:
function showToolbar()
{
// AddItem(id, text, hint, location, alternativeLocation);
// AddSubItem(idParent, text, hint, location);

menu = new Menu();
menu.addItem("photoid", "Photos", "Photos", null, null);
menu.addItem("musicid", "Music", "Music", null, null);
menu.addItem("biographyid", "Biographies", "Biographies", null, null);
menu.addItem("showsid", "Dates", "Dates", null, null);
menu.addItem("contactid", "Contact Info", "Contact Info", null, null);

menu.addSubItem("photoid", "Band Photos", "Band Photos", "http://www.trakxero.com/bios/bio.html");
menu.addSubItem("photoid", "Individual Photos", "INdividual Photos", "http://www.wsabstract.com/");
menu.addSubItem("photoid", "Other", "Other", "http://www.webreview.com/");

menu.addSubItem("musicid", "Samples", "Samples", "http://www.cnn.com");
menu.addSubItem("musicid", "Lyrics", "Lyrics", "http://www.abcnews.com");

menu.addSubItem("biographyid", "Band Bio", "Band Bio", "http://www.dynamicdrive.com/");
menu.addSubItem("biographyid", "Individual Bios", "Individual Bios", "http://download.com/");

menu.addSubItem("showsid", "Upcoming Shows", "Upcoming Shows", "http://www.yahoo.com/");

menu.addSubItem("contactid", "Brett", "Brett", "mailto:lucent100@aol.com");
menu.addSubItem("contactid", "Joel", "Joel", "mailto:sublink44@aol.com");
menu.addSubItem("contactid", "Jose", "Jose", "mailto:SushiWan99@aol.com");
menu.addSubItem("contactid", "Chad", "Chad", "mailto:brinkdrum@aol.com");
menu.addSubItem("contactid", "Info", "Info", "mailto:info@trakxero.com");
menu.addSubItem("contactid", "Street Team", "Street Team", "mailto:gunghogun@hotmail.com");
menu.addSubItem("contactid", "Webmaster", "Webmaster", "mailto:webmaster@trakxero.com");

menu.showMenu();
}



and I want to add the following JS so I can have size controlled pop up windows.

code:
<script language="javaScript">
function openWin(url,name,parms){
window.open(url,name,parms);
}
</script>

<a href="#" onClick="openWin('/images/skate_rail_large.jpg','Rail','width=721,height=192');"></a>



I was wondering how I can combine both of these to have the static menu that is able to open up pop up windows. Can someone help me out please?!

Thanks in advance!


Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 01-14-2002 08:37

Looks simple enough... Lets see...

The window popup function would also work the same if you specified the <a> tag like so:

code:
<script language="javaScript">
function openWin(url,name,parms){
window.open(url,name,parms);
}
</script>

<a href="javascript:openWin('/images/skate_rail_large.jpg','Rail','width=721,height=192')">Click Me!</a>



So, if we can do that all we have to do is input that into the URL section of the following script like so:

code:
function showToolbar()
{
// AddItem(id, text, hint, location, alternativeLocation);
// AddSubItem(idParent, text, hint, location);

menu = new Menu();
menu.addItem("photoid", "Photos", "Photos", null, null);
menu.addItem("....... blah blah blah

menu.addSubItem("photoid", "Band Photos", "Band Photos", "javascript:openWin('http://www.cnn.com','Rail','width=721,height=192')");
menu.addSubItem("photoid", "Individual Photos", "INdividual Photos", "javascript:openWin('http://www.abcnews.com','Rail','width=721,height=192')");
menu.addSubItem("photoid", "Other", "Other", "javascript:openWin('http://www.dynamicdrive.com/','Rail','width=721,height=192')");

menu.showMenu();
}



Does that make sence?

It should work but I haven't tested it. If it doesn't let me know...



Edit: Since when did the <code> </code> UBB not disable slimies?

[This message has been edited by Dracusis (edited 01-14-2002).]

Skatefx
Bipolar (III) Inmate

From: Small Patch of Grass in CT
Insane since: Mar 2001

posted posted 01-14-2002 08:54

Is there a way to add the first JS to the second one. Because the second is stored in its own .js file but the other one is inserted into the head of the document (I think). So can I combine the first one into the second?

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 01-14-2002 09:04

Well, The scripts should still work how they are but if you want to have them all in the one sopt, just start with the first script:

<script language="javaScript">
function openWin(url,name,parms){
window.open(url,name,parms);
}


Then you cut and psate the entire contents of the .js file right here


</script>

Then you no longer need to load the .js file ar all.

However, there's no problem with having inline scripts and loaded scripts in the same HTML page. They'll all work fine togther unless they have conflicting event handlers or variabules. Some of my pages have inline scripts in the head and the body that depend on functions that are loaded from several external javascript files.

If you wanted to you could cut and paste the popup script into the .js file (Without the <script></script> tags) and it would also work. It's all rather flexiabul so do what suits you best.

Loading Javascript form an extrenal file means it doesn't have to load on every page you wish to use it on. The file loads once and is then in the browser cache. So if your using the scripts on various pages I'd suggest the external .js file approach.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-14-2002 09:38

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 01-14-2002 12:44

Oh... I just assumed you didn't post all of the code for the menu script. Only the
bit you were told you could customise yourself. Although my inital example
should still work as long as the external javascript object for the menu is
loaded. Shouldn't it?

Yeah, post all of the code or even better, just set up a test menu without the
window popup script. Then post the link to your test page and we should be able
to work the window popup into it.

Then you can run with it from there. Trying to read code directly from forums
gives me a headache sometimes.

Oh InI, I don't suppose you'd be willing to lend a hand with the problem I ran
into in this thread: http://www.ozoneasylum.com/Forum2/HTML/001290.html
I'm sure you'll be able to point out where I messed up yet again!

Come on... I'll be your best friend

[This message has been edited by Dracusis (edited 01-14-2002).]

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-14-2002 14:08

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 01-14-2002 14:23

As for the Opacity script, it's not that it won't really work correctly. It does work, it just gets confused when I call the same function for different images. The onMouseOut() trigers and it starts to fade out but stops again when the onMouseOver() trigers for a different image. Which means the previous image doesn't finish fading out. Nevermind, I've yet to finish playing with it, I should be ale to figure it out eventualy.

Format C? Hummm.. No, I don't think I wanna play that one. How about Wakko Throwing? He's not that heavy is he?

PSPong. Why, that sounds like a challenge. ~get's out metal gauntlet and slapps InI accross the face~ I Accept! You want to set up the thread to play in?

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-14-2002 14:56

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 01-14-2002 15:30

Yup, it's the overlapping TimeOuts. I hacked into the code
and changed it from alhpa blending to sliding a div to the
left on mouse over and to the right on mouse out. The same
thing was happening. Like so.

Anyway, Tommorow for start of the PSPong match sounds
good. It's late down here and I have a centerlink meeting
in the monring before I start work so I have to be up extra
early.

Edit: Wrapping the text....

[This message has been edited by Dracusis (edited 01-14-2002).]

Skatefx
Bipolar (III) Inmate

From: Small Patch of Grass in CT
Insane since: Mar 2001

posted posted 01-15-2002 05:16

OK here ini, I tryed a couple different methods and none of them worked. here is the 3 files. 2 are js and one is the html.

This is menucontext.js

code:
function showToolbar()
{
// AddItem(id, text, hint, location, alternativeLocation);
// AddSubItem(idParent, text, hint, location);

menu = new Menu();
menu.addItem("photoid", "Photos", "Photos", null, null);
menu.addItem("musicid", "Music", "Music", null, null);
menu.addItem("biographyid", "Biographies", "Biographies", null, null);
menu.addItem("showsid", "Dates", "Dates", null, null);
menu.addItem("contactid", "Contact Info", "Contact Info", null, null);

menu.addSubItem("photoid", "Band Photos", "Band Photos", "javascript :openWin('http://www.cnn.com','Rail','width=721,height=192')");
menu.addSubItem("photoid", "Individual Photos", "INdividual Photos", "http://www.wsabstract.com/");
menu.addSubItem("photoid", "Other", "Other", "http://www.webreview.com/");
menu.addSubItem("photoid", "", "", "");

menu.addSubItem("musicid", "Samples", "Samples", "http://www.cnn.com");
menu.addSubItem("musicid", "Lyrics", "Lyrics", "http://www.abcnews.com");
menu.addSubItem("musicid", "", "", "");

menu.addSubItem("biographyid", "Band Bio", "Band Bio", "http://www.dynamicdrive.com/");
menu.addSubItem("biographyid", "Individual Bios", "Individual Bios", "http://download.com/");
menu.addSubItem("biographyid", "", "", "");

menu.addSubItem("showsid", "Upcoming Shows", "Upcoming Shows", "http://www.yahoo.com/");
menu.addSubItem("showsid", "", "", "");

menu.addSubItem("contactid", "Brett", "Brett", "mailto:lucent100@aol.com");
menu.addSubItem("contactid", "Joel", "Joel", "mailto:sublink44@aol.com");
menu.addSubItem("contactid", "Jose", "Jose", "mailto:SushiWan99@aol.com");
menu.addSubItem("contactid", "Chad", "Chad", "mailto:brinkdrum@aol.com");
menu.addSubItem("contactid", "Info", "Info", "mailto:info@trakxero.com");
menu.addSubItem("contactid", "Street Team", "Street Team", "mailto:gunghogun@hotmail.com");
menu.addSubItem("contactid", "Webmaster", "Webmaster", "mailto:webmaster@trakxero.com");
menu.addSubItem("contactid", "", "", "");

menu.showMenu();
}



this is menu.js
<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
if (document.all) {n=0;ie=1;fShow="visible";fHide="hidden";}
if (document.layers) {n=1;ie=0;fShow="show"; fHide="hide";}

window.onerror=new Function("return true")
////////////////////////////////////////////////////////////////////////////
// Function Menu() //
////////////////////////////////////////////////////////////////////////////
rightX = 0;
function Menu()
{
this.bgColor = "#0A0770";
if (ie) this.menuFont = "bold xx-small Verdana";
if (n) this.menuFont = "bold x-small Verdana";
// this.fontColor = "white";

this.addItem = addItem;
this.addSubItem = addSubItem;
this.showMenu = showMenu;
this.mainPaneBorder = 1;
this.subMenuPaneBorder = 1;

this.subMenuPaneWidth = 150;

lastMenu = null;

rightY = 0;
leftY = 0;
leftX = 0;

HTMLstr = "";
HTMLstr += "<!-- MENU PANE DECLARATION BEGINS -->\n";
HTMLstr += "\n";
if (ie) HTMLstr += "<div id='MainTable' style='position:relative'>\n";
// if (n) HTMLstr += "<layer name='MainTable'>\n";
HTMLstr += "<table width='100%' bgcolor='"+this.bgColor+"' style='border-style: solid; border-bottom-width: 1px; border-top-width: 1px; border-left-width: 1px; border-right-width: 1px; border-color: F0F80D'>\n";
HTMLstr += "<tr>";
if (n) HTMLstr += "<td>&nbsp;";
HTMLstr += "<!-- MAIN MENU STARTS -->\n";
HTMLstr += "<!-- MAIN_MENU -->\n";
HTMLstr += "<!-- MAIN MENU ENDS -->\n";
if (n) HTMLstr += "</td>";
HTMLstr += "</tr>\n";
HTMLstr += "</table>\n";
HTMLstr += "\n";
HTMLstr += "<!-- SUB MENU STARTS -->\n";
HTMLstr += "<!-- SUB_MENU -->\n";
HTMLstr += "<!-- SUB MENU ENDS -->\n";
HTMLstr += "\n";
if (ie) HTMLstr+= "</div>\n";
// if (n) HTMLstr+= "</layer>\n";
HTMLstr += "<!-- MENU PANE DECALARATION ENDS -->\n";
}

function addItem(idItem, text, hint, location, altLocation)
{
var Lookup = "<!-- ITEM "+idItem+" -->";
if (HTMLstr.indexOf(Lookup) != -1)
{
alert(idParent + " already exist");
return;
}
var MENUitem = "";
MENUitem += "\n<!-- ITEM "+idItem+" -->\n";
if (n)
{
MENUitem += "<ilayer name="+idItem+">";
MENUitem += "<a href='.' class=clsMenuItemNS onmouseover=\"displaySubMenu('"+idItem+"')\" onclick=\"return false;\">";
MENUitem += "

DigitalUbiquity
Bipolar (III) Inmate

From: St. Paul, MN, USA
Insane since: Jan 2002

posted posted 01-21-2002 22:17

For anyone who is interested, this thread was continued here...

click here baby

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-22-2002 06:42

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

« BackwardsOnwards »

Show Forum Drop Down Menu