473,671 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Script for depressible buttons?

Is there a script for depressible buttons that work in Mozilla and IE?

This works nice but only in IE:
http://www.dynamicdrive.com/dynamici...ressbutton.htm.

Thanks,
Brett
Jul 23 '05 #1
9 1687
Brett wrote:
Is there a script for depressible buttons that work in Mozilla and IE?

This works nice but only in IE:
http://www.dynamicdrive.com/dynamici...ressbutton.htm.

Thanks,
Brett


"Easy to install and degrades well with all other browsers."

Rubbish, they don't work at all in Firefox. The effect is a "button"
that doesn't look like a button or a link, but if you click on it, off
you go to the new location. All that happens (in IE) is that the
borders are changed to simulate the "button" being depressed. The
author couldn't even write cross-browser JS to do it - what quality.

I'm sure someone here can do a better version in 10 minutes. Right now
I gotta do work...

Rob.
Jul 23 '05 #2
RobG wrote:
Brett wrote:
Is there a script for depressible buttons that work in Mozilla and IE?
[snip] I'm sure someone here can do a better version in 10 minutes. Right now
I gotta do work...


The functions are compatible with more browsers if the following:

function makeRaised(el) {
with (el.style) {
borderLeft = "1px solid buttonhighlight ";
borderRight = "1px solid buttonshadow";
borderTop = "1px solid buttonhighlight ";
borderBottom = "1px solid buttonshadow";
padding = "1px";
}
}

is rewritten as:

function makeRaised(el) {
el.style.border Left = "1px solid buttonhighlight ";
el.style.border Right = "1px solid buttonshadow";
el.style.border Top = "1px solid buttonhighlight ";
el.style.border Bottom = "1px solid buttonshadow";
el.style.paddin g = "1px";
}

and similarly for makePressed().

I've only performed minimal testing (IE and Firefox) so there is a lot
more work to do to make it robust, but it shows how trivial it is to
make IE-specific code into cross-browser code.

Cheers, Rob.
Jul 23 '05 #3
RobG wrote:
RobG wrote:
Brett wrote:
Is there a script for depressible buttons that work in Mozilla and IE?


[snip]
I'm sure someone here can do a better version in 10 minutes. Right now
I gotta do work...

The functions are compatible with more browsers if the following:

function makeRaised(el) {
with (el.style) {
borderLeft = "1px solid buttonhighlight ";
borderRight = "1px solid buttonshadow";
borderTop = "1px solid buttonhighlight ";
borderBottom = "1px solid buttonshadow";
padding = "1px";
}
}

is rewritten as:

function makeRaised(el) {
el.style.border Left = "1px solid buttonhighlight ";
el.style.border Right = "1px solid buttonshadow";
el.style.border Top = "1px solid buttonhighlight ";
el.style.border Bottom = "1px solid buttonshadow";
el.style.paddin g = "1px";
}

and similarly for makePressed().

I've only performed minimal testing (IE and Firefox) so there is a lot
more work to do to make it robust, but it shows how trivial it is to
make IE-specific code into cross-browser code.


It also shows, pretty well, how badly people can write code and have it
"published" on the web. Sad state of affairs.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #4

"RobG" <rg***@iinet.ne t.auau> wrote in message
news:o3******** *********@news. optus.net.au...
RobG wrote:
Brett wrote:
Is there a script for depressible buttons that work in Mozilla and IE?

[snip]
I'm sure someone here can do a better version in 10 minutes. Right now
I gotta do work...


The functions are compatible with more browsers if the following:

function makeRaised(el) {
with (el.style) {
borderLeft = "1px solid buttonhighlight ";
borderRight = "1px solid buttonshadow";
borderTop = "1px solid buttonhighlight ";
borderBottom = "1px solid buttonshadow";
padding = "1px";
}
}

is rewritten as:

function makeRaised(el) {
el.style.border Left = "1px solid buttonhighlight ";
el.style.border Right = "1px solid buttonshadow";
el.style.border Top = "1px solid buttonhighlight ";
el.style.border Bottom = "1px solid buttonshadow";
el.style.paddin g = "1px";
}

and similarly for makePressed().

I've only performed minimal testing (IE and Firefox) so there is a lot
more work to do to make it robust, but it shows how trivial it is to
make IE-specific code into cross-browser code.

Cheers, Rob.


Rob,

Thanks. I'm particularly interested in example 2, this code:

<div class="coolBar" style="width:10 0px">
<span class="coolButt on" style="width:10 0px"
onClick="window .location='http ://dynamicdrive.co m'"><img src="home.gif">
<b>Back Home</b></span>
</div>

I've tried the changes you mentioned but still get no effect in Netscape
7,.2 or Firefox. Any ideas how to get the above working for those?

Thanks again,
Brett
Jul 23 '05 #5
Brett wrote:
Is there a script for depressible buttons that work in Mozilla and IE?

This works nice but only in IE:
http://www.dynamicdrive.com/dynamici...ressbutton.htm.


It doesn't look too good in IE either.

Anyway, you shouldn't be using Javascript to do this kind of thing if you
can avoid it.

Try this for example:

<STYLE type="text/css">
A {
position: relative;
top: 0px;
left: 0px;
color: #00f;
font-weight: bold;
background-color: #eef;
padding: 1px 3px 1px 3px;
border: 2px outset #aad;
}

A:active {
top: 1px;
left: 1px;
color: #000;
padding: 2px 2px 0px 4px;
border: 2px inset #aad;
}
</STYLE>
--
Philip Ronan
ph***********@v irgin.net
(Please remove the "z"s if replying by email)
Jul 23 '05 #6
Brett wrote:
[snip]
Thanks. I'm particularly interested in example 2, this code:

<div class="coolBar" style="width:10 0px">
<span class="coolButt on" style="width:10 0px"
onClick="window .location='http ://dynamicdrive.co m'"><img src="home.gif">
<b>Back Home</b></span>
</div>

I've tried the changes you mentioned but still get no effect in Netscape
7,.2 or Firefox. Any ideas how to get the above working for those?


Why use JavaScript to follow links? Users with JS disabled will click
the "link" nothing will happen. Also, the cursor will change to an
"I" bar because it's over text, not a hand pointer for a link -
confusing users. So you need to handle the cursor too...

<a href=...> was create just for links. It uses HTML, every browser
ever created knows what it is and how to use it, and you can make it
look however you want. Consider Philip's post, I've slightly adapted
it.

Cheers, Fred.
<html><head><ti tle> button play </title>
<STYLE type="text/css">
A {
position: relative;
top: 0px;
left: 0px;
color: #00f;
font-weight: bold;
background-color: #eef;
padding: 1px 3px 1px 3px;
border: 2px outset #aad;
}

A:active {
top: 1px;
left: 1px;
color: #000;
padding: 8px 8px 8px 8px;
border: 2px inset #aad;
text-decoration: none;
}
A:visited {
top: 0px;
left: 0px;
color: #000;
padding: 8px 8px 8px 8px;
border: 2px inset #aad;
text-decoration: none;
}
</STYLE>
</head>
<body style="margin: 20px 0px 0px 20px;">

<span><a href="http://www.apple.com"> Go to Apple</a></span>

</html>
Jul 23 '05 #7

"Philip Ronan" <ph***********@ virgin.net> wrote in message
news:BD99480E.2 3EF1%ph******** ***@virgin.net. ..
Brett wrote:
Is there a script for depressible buttons that work in Mozilla and IE?

This works nice but only in IE:
http://www.dynamicdrive.com/dynamici...ressbutton.htm.


It doesn't look too good in IE either.

Anyway, you shouldn't be using Javascript to do this kind of thing if you
can avoid it.

Try this for example:

<STYLE type="text/css">
A {
position: relative;
top: 0px;
left: 0px;
color: #00f;
font-weight: bold;
background-color: #eef;
padding: 1px 3px 1px 3px;
border: 2px outset #aad;
}

A:active {
top: 1px;
left: 1px;
color: #000;
padding: 2px 2px 0px 4px;
border: 2px inset #aad;
}
</STYLE>
--
Philip Ronan
ph***********@v irgin.net
(Please remove the "z"s if replying by email)


Thanks. That's pretty good. Is there a way to make it pop back up once it
is depressed.

I don't really need it for the href. I'm using an image's onClick to do
something else. I'd like to have the image (Just a colored circle) depress
rather than text. Is there a way to draw a color circle using something
similar to the above and have it depress than pop back up? I would then use
the href to direct the user to some location (actually I'm making a table
row appear).

Thanks,
Brett

Jul 23 '05 #8
"Brett" <no@spam.net> wrote in message
news:Ce******** ************@rc n.net...

I don't really need it for the href. I'm using an image's onClick to do
something else. I'd like to have the image (Just a colored circle)
depress
rather than text. Is there a way to draw a color circle using something
similar to the above and have it depress than pop back up? I would then
use
the href to direct the user to some location (actually I'm making a table
row appear).


You're running up against the most basic headache of the WWW.

The original intent (of the designers of the WWW and hence browsers) was to
handle text and links. Hence "HTML" as "Hyper Text Markup Language".

But, increasingly, people want to use the WWW and browsers to develop
on-line applications. So they are looking for an API that gives them
buttons, menus, dialogs, text areas, and so forth, that behave with all the
flexibility of a programming API.

This may happen. But meanwhile, you're forced to all sorts of strange
contortions to try to fit the richness of a programming API onto HTML
browsers.

You can put tons of JS on a page, and thereby do much of what you want.
Java applets provide some help, as do things like Flash, but you're still
trying to stretch things to fit. But the more you do this, the more your
page risks being browser-specific and platform-specific, the more work you
have to do, and the fewer people who will experience your UI as you
intended.

I keep hoping there's a way out of this box. Meanwhile, my advice (which I
keep repeating to myself and to my clients) is "don't try to use the Web as
a replacement for applications." For the time being, these are two separate
spaces. The closer you keep your web "applicatio ns" to the things that
browsers do well, the easier it will be to develop your code, and the easier
it will be for users to get full usefulness from your work. And, this
sucks, because you just can't get very creative.
Jul 23 '05 #9
Dana Cartwright wrote:
"Brett" <no@spam.net> wrote in message
news:Ce******** ************@rc n.net...
I don't really need it for the href. I'm using an image's onClick to do
something else. I'd like to have the image (Just a colored circle)
depress
rather than text. Is there a way to draw a color circle using something
similar to the above and have it depress than pop back up? I would then
use
the href to direct the user to some location (actually I'm making a table
row appear).

You're running up against the most basic headache of the WWW.

The original intent (of the designers of the WWW and hence browsers) was to
handle text and links. Hence "HTML" as "Hyper Text Markup Language".


No it wasn't. The web was before HTML. The original intent of the web,
and still is today, is the sharing of information. Nothing more, nothing
less. HTML just happens to be one method used to share that information.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #10

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

Similar topics

14
1520
by: Rich | last post by:
I have a project that I would Greatly Appreciate some direction. My goal is to create a "Sales Assistant Script" that recommends products based upon Response's to questions. I know enough JavaScript to successfully create a "JavaScript Error" 2 out of 3 times! <Grin> The books I have read are great in regards to understanding what the code is doing, but in my novice opinion don't teach me the "when to use what"
18
2260
by: Ed Jay | last post by:
<disclaimer>js newbie</disclaimer> My page has a form comprised of several radio buttons. I want to poll the buttons to determine which button was selected and convert its value to a string. I then want to use the string on the same page. My script is: function checkRadio(field) { for(var i=0; i < field.length; i++) {
5
1437
by: | last post by:
Looking to do something pretty simple... I have a cancel button on my page. When the user clicks it, i want to verify they want to cancel and if so, redirect them. Code: ------------------------------------------------------------- <html> <script language=vbscript> if MsgBox("Testing",4) = 6 Then window.location = "http://www.google.com"
3
2760
by: Learner | last post by:
Hello, I have two buttons on one of my VehicleDetails.aspx page. Obiviously these two buttons takes the user to two different pages. Now my client is interested in having a linkbutton instead of the two buttons. Once the user clicks on the linkbutton a javascript dialog box popsup that says "Is the Lessee buying this vehicle?" and with two buttons "Yes" and "No". If user clicks "yes" it should go to DealerQuestions.aspx" and if "No" it...
5
2141
by: Mirovk | last post by:
The onclick action associated to my form´s radio buttons call to a vbscript were the session values are changed, this happens correctly but with the onclick action associated to my continue button always shows the value =1 instead the values selected under my radio buttons (Values= 4,3 or 1) I am showing the code. Ideas welcome.
2
1982
by: Bundy | last post by:
Hi On my webpages I have replaced the submit button with a rolling submit button using the script below (Script 1). This script is used by many of my webpages and is included in a external file. There are two webpages that use onSubmit event handler to fire a script in an external file but the event handler is no longer firing. onSubmit ="return validating_username_and_password()"
0
4349
by: SirMikesALot | last post by:
I'm pretty good at Excel, but my skills in Visual Basic are very limited. I found script on-line that creates & opens a user form, allows you to select your worksheets, prints the selected worksheet, and then deletes the user form. I tried running it, but I keep on getting a "Run-time error '1004'". Do you have any suggestions on how to fix it? Here's the script and thank you in advance: Sub SelectSheets() Dim i As Integer Dim...
0
1814
by: evo27 | last post by:
hi guys. I'm trying to make a navigation menu with AS tweening. So far I have all 4 buttons and a graphic inside a movie clip named "logo_mc" with an instance name of "logo_mc". I have managed to AS tween the movment of the logo_mc clip with each of the 4 buttons and position the x & y of the "logo_mc" accordingly. Though if I press any of the other button the logo_mc ends up moving in places on screen where I don't want them to go. Here...
6
2791
by: tvnaidu | last post by:
Hi: Any stress test html script to test web page contains few radio buttons and apply. I have web page contains 8 radio buttons, just select on / off using radio button, then at the bottom, click on "apply", I need some script to do this overnight to stress the system, please let me know if any script availbale, appreciated. TV.
0
8400
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.