473,372 Members | 878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Attaching "onClick" javascript code to fireworks popup menu links

I am currenly developing a web site using Macromedia fireworks, and am
trying to figure out a way (through hand-coding) of attaching a
javascript function (onClick="doit=false") to each of the links in my
fireworks-generated dhtml popup menus. Does anyone here know where I
would add this javascript fucntion in the code so that it would be
recognized? And do I do it in the html, or in the JS file?

The javascript function I need to add is supposed to supress an exit
popup window. If I can't attach it to the links in the dhtml popup
menu, then that means that the popup will get spawned every time
someone click on one of the links, which woudl obviously be a problem.
Any tips or advice would be appreciated.

thanks,
- yvan
Jul 20 '05 #1
6 9912


Yvan J. Gagnon wrote:
I am currenly developing a web site using Macromedia fireworks, and am
trying to figure out a way (through hand-coding) of attaching a
javascript function (onClick="doit=false") to each of the links in my
fireworks-generated dhtml popup menus. Does anyone here know where I
would add this javascript fucntion in the code so that it would be
recognized? And do I do it in the html, or in the JS file?

The javascript function I need to add is supposed to supress an exit
popup window. If I can't attach it to the links in the dhtml popup
menu, then that means that the popup will get spawned every time
someone click on one of the links, which woudl obviously be a problem.
Any tips or advice would be appreciated.


I can't tell you anything about Firework menus, but an onclick handler
is attached with HTML as follows
<a href="whatever.html"
onclick="doit = false; return true;">Link</a>
If you want to attach the handler with script use
document.links[linkIndex].onclick = function (evt) {
doit = false; return true;
};
There are also IE5.5+ and Netscape 6 specific solutions which allow
attaching multiple event listeners to an element

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Martin Honnen <Ma***********@t-online.de> writes:
There are also IE5.5+ and Netscape 6 specific solutions which allow
attaching multiple event listeners to an element


I don't know what the IE solution is, but I assume the Netscape 6
solution you are referring to, is the addEventListener method.
It is not Netscape 6/Mozilla specific, but actually a W3C Standard
(DOM2 Events), and it also works in Opera 7+. I don't know if Safari
supports it, but I wouldn't be surprised, and if it doesn't, I bet
it will soon.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:of**********@hotpop.com...
There are also IE5.5+ and Netscape 6 specific solutions which allow
attaching multiple event listeners to an element


I don't know what the IE solution is, but I assume the Netscape 6
solution you are referring to, is the addEventListener method.
It is not Netscape 6/Mozilla specific, but actually a W3C Standard
(DOM2 Events), and it also works in Opera 7+. I don't know if Safari
supports it, but I wouldn't be surprised, and if it doesn't, I bet
it will soon.


The IE solution will be the - attachEvent - and - detachEvent - methods
of window, document and DOM elements. Similar to - addEventListener -
except that the function reference argument is executed in the global
context (instead of as a method of the object) and the "on" is required
to prefix the string that identifies the event (and specifying the event
phase is not an option).

Opera 7 also supports - attachEvent - and - detachEvent - and while
recent Opera 7 versions have dropped -addEventListener - from the
global object they have retained - attachEvent - on it.

var svType = (window.addEventListener && 2)||
(window.attachEvent && 1)|| 0;
....
switch(svType){
case 1:
window.attachEvent("onunload", fnRef);
break;
case 2:
window.addEventListener("unload", fnRef, false);
break;
default:
window.onunload = fnRef;
break;
}

Richard.
Jul 20 '05 #4
I must say that I'm a little confused here. Fireworks generates and
integrates both client-side and server-side javscript for the dhtml
menus, and I'm not sure which of the two I should be adding additional
markup to, or specifically what markup I should be adding. And are you
guys saying that it will have to be approached differently for both
Netscape and IE?

- yvan
Jul 20 '05 #5
"Yvan J. Gagnon" <yv**@ideasdesign.com> wrote in message
news:cb**************************@posting.google.c om...
I must say that I'm a little confused here. Fireworks generates
and integrates both client-side and server-side javscript for
the dhtml menus, and I'm not sure which of the two I should be
adding additional markup to, or specifically what markup I should
be adding. And are you guys saying that it will have to be
approached differently for both Netscape and IE?


You would not necessarily have to take a different approach for
different browsers (don't think in terms of "both" there are many
distinct browsers in use these days) as the approach that Martin Honnen
originally outlined will work with most, if not all, current JavaScript
capable browsers. The - addEventListener - and - attachEvent - methods
are only significant if you want to be able to attach more than one
event handling function to an element at the same time (and even then
they are not strictly necessary in order to have multiple event handling
functions, but that is fairly advanced JavaScript).

If you don't know how to implement Martin's suggestion you may have a
problem. No one will be able to tell you whether it would be better
implemented in the HTML output by the server or in the JavaScript
without being able to see and understand both. Unfortunately Macromedia
products tend to output massively bloated HTML and poor and garbled
JavaScript. I for one am not willing to devote any of my spare time to
wading through Macromedia code in order to try to extract meaning from
it. You could post the URL of a working on-line example and see if
anyone was interested in taking a look, you might get lucky.

The situation is that the people who use Macromedia web authoring
products do not tend to have the technical skills to comprehend their
output and the people who have the technical skills do not tend to use
Macromedia products to do what they can do better by hand. If an overlap
exists it is as likely to be represented on a Macromedia newsgroup as
here (though what I have seen of JavaScript on Macromedia newsgroups is
just an endless parade of dubious hacks).

Richard.

--

Example JavaScript DOM listings for: Opera 7.11,
Mozilla 1.2 and ICEbrowser 5.4
<URL: http://www.litotes.demon.co.uk/dom_root.html >
Jul 20 '05 #6
"Yvan J. Gagnon" <yv**@ideasdesign.com> wrote in message
news:cb**************************@posting.google.c om...
<snip>
... No one will be able to tell you whether it would be better
implemented in the HTML output by the server or in the
JavaScript without being able to see and understand both. ... <snip> ... (though what I have seen of JavaScript on Macromedia
newsgroups is just an endless parade of dubious hacks).

<snip>... You'd think that the folks in the Macromedia Fireworks
forums would have something to offer in this respect, but
they've been strangely silent, and non-responsive to my posts. ...
You might not have thought that it doesn't surprise me at all.

<snip>Below is the javascript code that is contained within my HTML
files. If someone here woulf be so kind as to give it a quick
once-over and let me know if this code can be modified to suit
my needs, I would be most grateful.
The reason I proposed posting the URL of an online version is that
isolated chunks of JavaScript without their accompanying context is
often of no value in working out what is going on. This code, for
example, appears to be configuration but without the script that defines
the objects and methods anything said about what is going on is pure
guesswork.

<snip>mm_menu_0624113106_0.addMenuItem(
"Identifying&nbsp;a&nbsp;Debt&nbsp;Problem",
"location='identify.html'");

<snip>

However, that - "location='identify.html'" - parameter looks
suspiciously like it is intended to be a the JavaScript source for an
onclick event handler. Its inclusion, and my assumptions about the
process behind this parameter, make it look like this fireworks menu is
totally failing to exploit the combination of server-side processing and
client side processing in a way that would produce a navigation system
that was not totally dependent on client side JavaScript to be operable,
but half-arse code is what I expect from Macromedia and they haven't
disappointed me yet.

On the other hand, from your point of view this might offer a way in.
Your stated intention is to have the code - doit=false - executed by the
onclick code for each link (presumable prior to navigation) so replacing
= "location='identify.html'" - with -
"doit=false;location='identify.html'" - (and the corresponding change
for each of the other addMenuItem calls) may be all that is needed.

Richard.
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: karunakar | last post by:
Hi All Here i want to show in datagrid Broder color as like image showed i attaching images pls check and help me out "Onlclick" i want to show red border color each row in DATAGRID in ASP.NET...
2
by: Peter | last post by:
Hi, this is the code, and new row and new cell generated ok, but why the onclick and onmouseover doen't work? Thank you in advance! <html> <head> <script language="javascript"> function...
2
by: Vincent van Beveren | last post by:
Hey everyone, I've looked for this and I wouldn't know what the best practice would be for solving the following problem. We use a BASE tag in our HTML pages. Now we have some links that use...
2
by: bay_dar | last post by:
Hi, I have an internal ASP.NET application that I'm are using to send e-mails out based on a single milepost or milepost range entered. I'm trying to do two things when a user clicks on the...
11
by: jesdynf | last post by:
I'm having trouble applying a stylesheet to content I'm generating after the fact. Here's the sample code: <html> <head> <title>CSS/DOM Problem Example</title> <style type="text/css">...
2
by: elia | last post by:
Hello, We change our server and before this code was ok: <a href="#" onClick="history.back()">Retour</a> ...but on the new server, it doesn't work anymore?? We come back, see the last page...
5
by: prathapavp | last post by:
hi all, We r working on ERP sys and am doing crossBrowser compatibility. The problem is am not able to load one function by onClicking the refrence text . could u please help me out.
5
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
5
by: frankrentef | last post by:
Newbie needs detailed help on an issue involving the use of a popup (Java) window. Simply I need to fire / activate the "OK" portion of the window. I'm using Pamie to generate automated testing...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.